summaryrefslogtreecommitdiffstats
path: root/menu
diff options
context:
space:
mode:
authorWaldo Bastian <waldo.bastian@intel.com>2007-01-19 01:14:02 +0000
committerWaldo Bastian <waldo.bastian@intel.com>2007-01-19 01:14:02 +0000
commit612c49cc74998f1fcff39b1cfde6a01f3c18c069 (patch)
tree1829be49189e6858afee76509845ad31f0ee6b74 /menu
parent7d249792235d0f3b69f833f89bef545a367f0b6b (diff)
downloadxdg-specs-612c49cc74998f1fcff39b1cfde6a01f3c18c069.tar.xz
Added support for LSB's TET test framework Renamed tests to more
* Added support for LSB's TET test framework * Renamed tests to more meaningful names (see ChangeLog for details)
Diffstat (limited to 'menu')
-rw-r--r--menu/ChangeLog51
-rwxr-xr-xmenu/tests/menutest265
-rw-r--r--menu/tests/tests/1/test24
-rw-r--r--menu/tests/tests/5/test25
-rw-r--r--menu/tests/tests/All/result (renamed from menu/tests/tests/5/result)0
-rw-r--r--menu/tests/tests/All/test26
-rw-r--r--menu/tests/tests/And/result (renamed from menu/tests/tests/6/result)0
-rw-r--r--menu/tests/tests/And/test (renamed from menu/tests/tests/7/test)15
-rw-r--r--menu/tests/tests/AppDir-relative/result (renamed from menu/tests/tests/g/result)0
-rw-r--r--menu/tests/tests/AppDir-relative/test27
-rw-r--r--menu/tests/tests/AppDir/test4
-rw-r--r--menu/tests/tests/Category/result (renamed from menu/tests/tests/1/result)0
-rw-r--r--menu/tests/tests/Category/test29
-rw-r--r--menu/tests/tests/DefaultMergeDirs/result (renamed from menu/tests/tests/i/result)0
-rw-r--r--menu/tests/tests/DefaultMergeDirs/test (renamed from menu/tests/tests/i/test)19
-rw-r--r--menu/tests/tests/Deleted/result (renamed from menu/tests/tests/3/result)0
-rw-r--r--menu/tests/tests/Deleted/test (renamed from menu/tests/tests/3/test)15
-rw-r--r--menu/tests/tests/DesktopFileID/result (renamed from menu/tests/tests/a/result)0
-rw-r--r--menu/tests/tests/DesktopFileID/test26
-rw-r--r--menu/tests/tests/Directory/result (renamed from menu/tests/tests/c/result)0
-rw-r--r--menu/tests/tests/Directory/test (renamed from menu/tests/tests/c/test)17
-rw-r--r--menu/tests/tests/DirectoryDir-relative/result (renamed from menu/tests/tests/h/result)0
-rw-r--r--menu/tests/tests/DirectoryDir-relative/test28
-rw-r--r--menu/tests/tests/DirectoryDir/test4
-rw-r--r--menu/tests/tests/Exclude/result (renamed from menu/tests/tests/9/result)0
-rw-r--r--menu/tests/tests/Exclude/test (renamed from menu/tests/tests/9/test)15
-rw-r--r--menu/tests/tests/Filename/result (renamed from menu/tests/tests/7/result)0
-rw-r--r--menu/tests/tests/Filename/test (renamed from menu/tests/tests/6/test)15
-rw-r--r--menu/tests/tests/LegacyDir-Move/result (renamed from menu/tests/tests/w/result)0
-rw-r--r--menu/tests/tests/LegacyDir-Move/test (renamed from menu/tests/tests/w/test)21
-rw-r--r--menu/tests/tests/LegacyDir-relative/result (renamed from menu/tests/tests/e/result)0
-rw-r--r--menu/tests/tests/LegacyDir-relative/test (renamed from menu/tests/tests/e/test)27
-rw-r--r--menu/tests/tests/Merge-combined/result (renamed from menu/tests/tests/y/result)0
-rw-r--r--menu/tests/tests/Merge-combined/test (renamed from menu/tests/tests/y/test)21
-rw-r--r--menu/tests/tests/MergeDir-absolute/test3
-rw-r--r--menu/tests/tests/MergeDir-relative/result (renamed from menu/tests/tests/j/result)0
-rw-r--r--menu/tests/tests/MergeDir-relative/test61
-rw-r--r--menu/tests/tests/MergeFile-absolute/test3
-rw-r--r--menu/tests/tests/MergeFile-parent/result (renamed from menu/tests/tests/k/result)0
-rw-r--r--menu/tests/tests/MergeFile-parent/test (renamed from menu/tests/tests/q/test)23
-rw-r--r--menu/tests/tests/MergeFile-path/result (renamed from menu/tests/tests/r/result)0
-rw-r--r--menu/tests/tests/MergeFile-path/test (renamed from menu/tests/tests/r/test)23
-rw-r--r--menu/tests/tests/MergeFile-recursive/result (renamed from menu/tests/tests/l/result)0
-rw-r--r--menu/tests/tests/MergeFile-recursive/test (renamed from menu/tests/tests/u/test)24
-rw-r--r--menu/tests/tests/MergeFile-relative/result (renamed from menu/tests/tests/p/result)0
-rw-r--r--menu/tests/tests/MergeFile-relative/test (renamed from menu/tests/tests/k/test)21
-rw-r--r--menu/tests/tests/MergeFile2/result (renamed from menu/tests/tests/q/result)0
-rw-r--r--menu/tests/tests/MergeFile2/test (renamed from menu/tests/tests/l/test)25
-rw-r--r--menu/tests/tests/MergeFile3/result (renamed from menu/tests/tests/u/result)0
-rw-r--r--menu/tests/tests/MergeFile3/test (renamed from menu/tests/tests/p/test)23
-rw-r--r--menu/tests/tests/Move-collapsing/result (renamed from menu/tests/tests/f/result)0
-rw-r--r--menu/tests/tests/Move-collapsing/test (renamed from menu/tests/tests/f/test)15
-rw-r--r--menu/tests/tests/Move-ordering/result (renamed from menu/tests/tests/t/result)0
-rw-r--r--menu/tests/tests/Move-ordering/test (renamed from menu/tests/tests/t/test)18
-rw-r--r--menu/tests/tests/Move-submenu/result (renamed from menu/tests/tests/x/result)0
-rw-r--r--menu/tests/tests/Move-submenu/test (renamed from menu/tests/tests/x/test)15
-rw-r--r--menu/tests/tests/Move/result (renamed from menu/tests/tests/4/result)0
-rw-r--r--menu/tests/tests/Move/test (renamed from menu/tests/tests/4/test)15
-rw-r--r--menu/tests/tests/NoDisplay/result (renamed from menu/tests/tests/m/result)0
-rw-r--r--menu/tests/tests/NoDisplay/test (renamed from menu/tests/tests/m/test)16
-rw-r--r--menu/tests/tests/NoDisplay2/result (renamed from menu/tests/tests/n/result)0
-rw-r--r--menu/tests/tests/NoDisplay2/test (renamed from menu/tests/tests/n/test)16
-rw-r--r--menu/tests/tests/NotOnlyUnallocated-default/result (renamed from menu/tests/tests/v/result)0
-rw-r--r--menu/tests/tests/NotOnlyUnallocated-default/test (renamed from menu/tests/tests/v/test)16
-rw-r--r--menu/tests/tests/OnlyUnallocated/result (renamed from menu/tests/tests/2/result)0
-rw-r--r--menu/tests/tests/OnlyUnallocated/test (renamed from menu/tests/tests/2/test)14
-rw-r--r--menu/tests/tests/Or/result (renamed from menu/tests/tests/8/result)0
-rw-r--r--menu/tests/tests/Or/test (renamed from menu/tests/tests/8/test)15
-rw-r--r--menu/tests/tests/a/test25
-rw-r--r--menu/tests/tests/boolean-logic/result (renamed from menu/tests/tests/o/result)0
-rw-r--r--menu/tests/tests/boolean-logic/test36
-rw-r--r--menu/tests/tests/desktop-name-collision/result (renamed from menu/tests/tests/s/result)0
-rw-r--r--menu/tests/tests/desktop-name-collision/test53
-rw-r--r--menu/tests/tests/g/test25
-rw-r--r--menu/tests/tests/h/test28
-rw-r--r--menu/tests/tests/j/test42
-rw-r--r--menu/tests/tests/menu-multiple-matching/result (renamed from menu/tests/tests/b/result)0
-rw-r--r--menu/tests/tests/menu-multiple-matching/test (renamed from menu/tests/tests/b/test)15
-rw-r--r--menu/tests/tests/o/test34
-rw-r--r--menu/tests/tests/official-categories/categories.list10
-rw-r--r--menu/tests/tests/official-categories/test73
-rw-r--r--menu/tests/tests/official-categories/unique-entry.desktop9
-rw-r--r--menu/tests/tests/s/test51
-rw-r--r--menu/tests/tests/submenu-collision/result (renamed from menu/tests/tests/d/result)0
-rw-r--r--menu/tests/tests/submenu-collision/test (renamed from menu/tests/tests/d/test)15
-rwxr-xr-xmenu/tests/tet_menutest39
-rw-r--r--menu/tet_scen5
-rw-r--r--menu/tetexec.cfg1
88 files changed, 905 insertions, 576 deletions
diff --git a/menu/ChangeLog b/menu/ChangeLog
index 21cc418..ca2f166 100644
--- a/menu/ChangeLog
+++ b/menu/ChangeLog
@@ -1,8 +1,55 @@
-2006-03-28 Waldo Bastian <waldo.bastin@intel.com>
+2007-01-18 Waldo Bastian <waldo.bastian@intel.com>
+
+ * Added support for LSB's tet testing framework
+
+ * Renamed test to more meaningful names:
+ 1 -> Category
+ 2 -> OnlyUnallocated
+ 3 -> Deleted
+ 4 -> Move
+ 5 -> All
+ 6 -> Filename
+ 7 -> And
+ 8 -> Or
+ 9 -> Exclude
+ a -> DesktopFileID
+ b -> menu-multiple-matching
+ c -> Directory
+ d -> submenu-collision
+ e -> LegacyDir-relative
+ f -> Move-collapsing
+ g -> AppDir-relative
+ h -> DirectoryDir-relative
+ i -> DefaultMergeDirs
+ j -> MergeDir-relative
+ k -> MergeFile-relative
+ l -> MergeFile2
+ m -> NoDisplay
+ n -> NoDisplay2
+ o -> boolean-logic
+ p -> MergeFile3
+ q -> MergeFile-parent
+ r -> MergeFile-path
+ s -> desktop-name-collision
+ t -> Move-ordering
+ u -> MergeFile-recursive
+ v -> NotOnlyUnallocated-default
+ w -> LegacyDir-Move
+ x -> Move-submenu
+ y -> Merge-combined
+
+ * Added the following new tests:
+ AppDir
+ DirectoryDir
+ MergeDir-absolute
+ MergeFile-absolute
+ official-categories
+
+2006-03-28 Waldo Bastian <waldo.bastian@intel.com>
* menu-spec.xml: Added example for installing sub-menu.
-2006-03-21 Waldo Bastian <waldo.bastin@intel.com>
+2006-03-21 Waldo Bastian <waldo.bastian@intel.com>
* menu-spec.xml: Recommend to use /usr/share for datadir
diff --git a/menu/tests/menutest b/menu/tests/menutest
index 6061ba8..9d37246 100755
--- a/menu/tests/menutest
+++ b/menu/tests/menutest
@@ -1,127 +1,200 @@
#!/bin/bash
-
+# these vars are usable *only* for debugging purposes; they're not allowed as part of the spec, thus don't use them.
+# set MENU_FAKE_PREFIX to a non empty val to force testing for if things would succeed if XDG_MENU_PREFIX were
+# implemented
+# set MENU_FAKE_APPLICATIONS to force a work around for applications-merged postfixing.
+#
function installData()
{
- local DIR=$1
- shift 1
- mkdir -p ${DIR}
+ local DIR="$1"
+ shift
+ mkdir -p "${DIR}"
for file in $*; do
- cp data/${file} ${DIR}
+ cp "data/${file}" "${DIR}"
+ WIPE[$WIPE_IDX]="${DIR}/${file}"
+ WIPE_IDX=$(( $WIPE_IDX + 1 ))
done
}
function installDataAs()
{
- local DIR=$1
- mkdir -p ${DIR}
- cp data/$2 ${DIR}/$3
+ local DIR="$1"
+ mkdir -p "${DIR}"
+ cp "data/$2" "${DIR}/$3"
+ WIPE[${WIPE_IDX}]="${DIR}/${3}"
+ WIPE_IDX=$(( $WIPE_IDX + 1 ))
}
-if [ "x${MENUTEST}" == "x" ]; then
- echo 'To run the test set $MENUTEST to your menu-spec implementation.'
- exit 1
-fi
-
-if [ "x${MENUTESTDIR}" == "x" ]; then
- MENUTESTDIR=/tmp/menutestdir
- echo Using ${MENUTESTDIR} as test directory, override with '$MENUTESTDIR.'
-else
- echo Using ${MENUTESTDIR} as test directory.
-fi
-
-export MENUTESTDIR
-
-if [ "x${TESTS}" == "x" ]; then
- TESTS=`ls tests`
-fi
+setup_local_xdg_vars() {
+ export XDG_CONFIG_HOME="${MENUTESTDIR}/xdg_config_home"
+ export XDG_DATA_HOME="${MENUTESTDIR}/xdg_data_home"
+ export XDG_CONFIG_DIR="${MENUTESTDIR}/xdg_config_dir"
+ export XDG_CONFIG_DIRS="$XDG_CONFIG_DIR:${XDG_CONFIG_DIRS}2"
+ export XDG_DATA_DIR="${MENUTESTDIR}/xdg_data_dir"
+ export XDG_DATA_DIRS="$XDG_DATA_DIR:${XDG_DATA_DIR}2"
+ export XDG_CACHE_HOME="${MENUTESTDIR}/xdg_cache_home"
+}
-FAILED=
-SUCCEEDED=
-for TEST in ${TESTS}; do
- if [ "${TEST}" == "CVS" ]; then
- continue
+setup_xdg_system_data_vars()
+{
+ export XDG_CACHE_HOME="${XDG_DATA_HOME:-${HOME}/.cache}"
+ export XDG_DATA_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}"
+ export XDG_CONFIG_DIR="${XDG_CONFIG_DIR:-/etc/xdg}"
+ if [ -z "${XDG_DATA_DIRS}" ]; then
+ export XDG_DATA_DIRS="/usr/local/share:/usr/share"
+ fi
+ export XDG_DATA_DIRS="${XDG_DATA_DIRS}:${MENUTESTDIR}/xdg_cache_dir"
+ export XDG_DATA_DIR="${XDG_DATA_DIRS//*:}"
+ if [ -z "${XDG_CONFIG_DIRS}" ]; then
+ export XDG_CONFIG_DIRS="/etc/xdg"
fi
+ export XDG_CONFIG_DIR="${XDG_CONFIG_DIRS/:*}"
+}
- echo
- rm -rf ${MENUTESTDIR} 2> /dev/null
- mkdir ${MENUTESTDIR}
- RESULT=tests/${TEST}/result
+run_test() {
+ if [ -z "$1" ]; then
+ echo "requires name of test directory to run"
+ exit 1
+ fi
+ local TEST="$1"
+ rm -rf "${MENUTESTDIR}" 2> /dev/null
+ mkdir "${MENUTESTDIR}"
+ RESULT="${TEST}/result"
(
- echo ">>> Running test ${TEST}"
-
- # Some predefined values
- XDG_CONFIG_HOME=${MENUTESTDIR}/xdg_config_home
- XDG_DATA_HOME=${MENUTESTDIR}/xdg_data_home
- XDG_CONFIG_DIR=${MENUTESTDIR}/xdg_config_dir
- XDG_DATA_DIR=${MENUTESTDIR}/xdg_data_dir
- XDG_CONFIG_DIRS=$XDG_CONFIG_DIR
- XDG_DATA_DIRS=$XDG_DATA_DIR
-
- export XDG_CONFIG_HOME
- export XDG_DATA_HOME
- export XDG_CONFIG_DIR
- export XDG_DATA_DIR
- export XDG_CONFIG_DIRS
- export XDG_DATA_DIRS
-
- . tests/${TEST}/test
+ unset WIPE WIPE_IDX
+ declare -a WIPE
+ declare -i WIPE_IDX=0
+ unset MODE
+
+ . ${TEST}/test
+ echo ">>> Running test ${TEST}, purpose $TEST_PURPOSE"
+
+ if [ "${MODE:-local}" == "local" ]; then
+ setup_local_xdg_vars
+ elif [ "${MODE}" == "system_data" ]; then
+ setup_xdg_system_data_vars
+ else
+ echo "!!! unknown MODE from $TEST, bailing"
+ exit -1
+ fi
- $MENUTEST > ${MENUTESTDIR}/result1 2> ${MENUTESTDIR}/log
+ test_code
+
+ declare -i IDX=0
+ while [ $WIPE_IDX -gt $IDX ]; do
+ echo "${WIPE[$IDX]}" >> "${MENUTESTDIR}/wipe"
+ IDX=$(( $IDX + 1 ))
+ done
+
+ DEBUG_OVERRIDES=''
+ [ -n "$MENU_FAKE_PREFIX" ] && DEBUG_OVERRIDES=.menu
+ [ -n "$MENU_FAKE_APPLICATIONS" ] && DEBUG_OVERIDES="${DEBUG_OVERRIDES} -merged"
+
+ for x in dir home; do
+ for y in ${DEBUG_OVERRIDES}; do
+ if [ -e "${MENUTESTDIR}/xdg_config_${x}/menus/applications${y}" ]; then
+ ln -s applications${y} "${MENUTESTDIR}/xdg_config_${x}/menus/kde-applications${y}"
+ ln -s applications${y} "${MENUTESTDIR}/xdg_config_${x}/menus/gnome-applications${y}"
+ fi
+ done
+ unset y
+ done
+ unset x DEBUG_OVERRIDES
+
+ $MENUTEST > ${MENUTESTDIR}/run-result 2> ${MENUTESTDIR}/log
+
+ if [ -e "${RESULT}" ]; then
+ ./expand "${RESULT}" > "${MENUTESTDIR}/required-result"
+ fi
- if [ -e ${RESULT} ]; then
- ./expand ${RESULT} > ${MENUTESTDIR}/result2
+ if [ "$(type -t interpret_results)" == "function" ]; then
+ interpret_results
+ else
+ default_interpret_results
+ fi
+ ret=$?
+ if [ -e "${MENUTESTDIR}/wipe" ]; then
+ cat "${MENUTESTDIR}/wipe" | while read l; do
+ [ -z "$l" ] && continue
+ rm "$l"
+ done
fi
+ return $ret
)
+}
- if [ ! -e ${RESULT} ]; then
- echo '!!! Result file ('${RESULT}') for '${TEST}' missing'
+default_interpret_results() {
+ if [ ! -e "${RESULT}" ]; then
+ echo "!!! Result file (${RESULT}) for ${TEST} missing"
echo '>>> Failed'
- FAILED="${FAILED} ${TEST}"
+ return 1
+ elif diff -q "${MENUTESTDIR}/run-result" "${MENUTESTDIR}/required-result" > /dev/null; then
+ echo '>>> OK'
+ return 0
+ fi
+ sort "${MENUTESTDIR}/run-result" > "${MENUTESTDIR}/run-result.sorted"
+ sort "${MENUTESTDIR}/required-result" > "${MENUTESTDIR}/required-result.sorted"
+ if diff -u "${MENUTESTDIR}/run-result.sorted" "${MENUTESTDIR}/required-result.sorted" > "${MENUTESTDIR}/result.diff"; then
+ echo '>>> OK (different order)'
+ return 0
+ fi
+ grep "${MENUTESTDIR}" "${MENUTESTDIR}/run-result" > "${MENUTESTDIR}/run-result.filtered" 2> /dev/null
+ if diff -q "${MENUTESTDIR}/run-result.filtered" "${MENUTESTDIR}/required-result" > /dev/null; then
+ echo '>>> OK (additional system items)'
+ return 0
+ fi
+ grep "${MENUTESTDIR}" "${MENUTESTDIR}/run-result.sorted" > "${MENUTESTDIR}/required-result.filtered" 2> /dev/null
+ if diff -u "${MENUTESTDIR}/run-result.filtered" "${MENUTESTDIR}/required-result.sorted" > "${MENUTESTDIR}/result.diff"; then
+ echo '>>> OK (different order, additional system items)'
+ return 0
+ fi
+ echo '>>> Failed'
+ cat "${MENUTESTDIR}/result.diff"
+ cat "${MENUTESTDIR}/log"
+ return 1
+}
+
+if [ -z "${TESTS}" ]; then
+ export TESTS=`ls tests/*/test | sed -e 's:^\(\./\)\?tests/\+::' -e 's:/\+test$::'`
+fi
+
+if [ -z "$TET_RUN" ]; then
+
+ if [ "x${MENUTEST}" == "x" ]; then
+ echo 'To run the test set $MENUTEST to your menu-spec implementation.'
+ exit 1
+ fi
+ if [ "x${MENUTESTDIR}" == "x" ]; then
+ MENUTESTDIR=/tmp/menutestdir
+ echo Using ${MENUTESTDIR} as test directory, override with \$MENUTESTDIR.
else
- if diff -q ${MENUTESTDIR}/result1 ${MENUTESTDIR}/result2 > /dev/null; then
- echo '>>> OK'
- SUCCEEDED="${SUCCEEDED} ${TEST}"
- else
- sort ${MENUTESTDIR}/result1 > ${MENUTESTDIR}/result1.sorted
- sort ${MENUTESTDIR}/result2 > ${MENUTESTDIR}/result2.sorted
- if diff -u ${MENUTESTDIR}/result1.sorted ${MENUTESTDIR}/result2.sorted > ${MENUTESTDIR}/result.diff; then
- echo '>>> OK (different order)'
- SUCCEEDED="${SUCCEEDED} ${TEST}"
- else
- grep ${MENUTESTDIR} ${MENUTESTDIR}/result1 > ${MENUTESTDIR}/result1.filtered 2> /dev/null
- if diff -q ${MENUTESTDIR}/result1.filtered ${MENUTESTDIR}/result2 > /dev/null; then
- echo '>>> OK (additional system items)'
- SUCCEEDED="${SUCCEEDED} ${TEST}"
- else
- grep ${MENUTESTDIR} ${MENUTESTDIR}/result1.sorted > ${MENUTESTDIR}/result1.filtered 2> /dev/null
- if diff -u ${MENUTESTDIR}/result1.filtered ${MENUTESTDIR}/result2.sorted > ${MENUTESTDIR}/result.diff; then
- echo '>>> OK (different order, additional system items)'
- SUCCEEDED="${SUCCEEDED} ${TEST}"
- else
- echo '>>> Failed'
- cat ${MENUTESTDIR}/result.diff
- cat ${MENUTESTDIR}/log
- FAILED="${FAILED} ${TEST}"
- fi
- fi
- fi
- fi
+ echo Using ${MENUTESTDIR} as test directory.
fi
-done
+ export MENUTESTDIR
+ export USER=${USER:-test}
-echo "OK tests: ${SUCCEEDED}"
-if ! test -z "${FAILED}" ; then
- echo "Failed tests: ${FAILED}"
-fi
+ FAILED=
+ SUCCEEDED=
-echo `echo ${SUCCEEDED} | wc -w`' tests passed, '`echo ${FAILED} | wc -w`' tests failed'
+ for TESTCASE in ${TESTS}; do
+ if [ "${TESTCASE}" == "CVS" ]; then
+ continue
+ fi
+ echo
+ if ! run_test "tests/${TESTCASE}" ${MODE}; then
+ FAILED="${FAILED} ${TESTCASE}"
+ else
+ SUCCEEDED="${SUCCEEDED} ${TESTCASE}"
+ fi
+ done
-if test -z "${FAILED}" ; then
- exit 0
-else
- exit 1
+ echo "OK tests: ${SUCCEEDED}"
+ [ -n "${FAILED}" ] && echo "Failed tests: ${FAILED}"
+ echo "$(echo ${SUCCEEDED} | wc -w) tests passed, $(echo ${FAILED} | wc -w) tests failed"
+ [ -z "${FAILED}" ] && exit 0
+ exit 1
fi
diff --git a/menu/tests/tests/1/test b/menu/tests/tests/1/test
deleted file mode 100644
index 57cc0bb..0000000
--- a/menu/tests/tests/1/test
+++ /dev/null
@@ -1,24 +0,0 @@
-echo ">>> the <Category> tag"
-
-# Generate ${DIRTY_HACK}applications.menu
-mkdir -p ${XDG_CONFIG_DIR}/menus
-./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu <<EOF
- <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
- "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
-
-<Menu>
- <Name>KDE</Name>
- <!-- Search the default locations -->
- <DefaultAppDirs/>
-
- <Menu>
- <Name>Editors</Name>
- <Include>
- <Category>TextEditor</Category>
- </Include>
- </Menu>
-</Menu>
-EOF
-
-# Install .desktop files
-installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop kate.desktop
diff --git a/menu/tests/tests/5/test b/menu/tests/tests/5/test
deleted file mode 100644
index 45c734d..0000000
--- a/menu/tests/tests/5/test
+++ /dev/null
@@ -1,25 +0,0 @@
-echo ">>> the <All> Keyword"
-
-# Generate ${DIRTY_HACK}applications.menu
-mkdir -p ${XDG_CONFIG_DIR}/menus
-./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu <<EOF
- <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
- "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
-
-<Menu>
- <Name>KDE</Name>
- <!-- Search the default locations -->
- <DefaultAppDirs/>
-
- <Menu>
- <Name>Applications</Name>
- <Include>
- <All/>
- </Include>
- </Menu>
-</Menu>
-EOF
-
-
-# Install .desktop files
-installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop
diff --git a/menu/tests/tests/5/result b/menu/tests/tests/All/result
index fc75a82..fc75a82 100644
--- a/menu/tests/tests/5/result
+++ b/menu/tests/tests/All/result
diff --git a/menu/tests/tests/All/test b/menu/tests/tests/All/test
new file mode 100644
index 0000000..e97bddc
--- /dev/null
+++ b/menu/tests/tests/All/test
@@ -0,0 +1,26 @@
+TEST_PURPOSE="<All> Keyword"
+
+test_code() {
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+ <!-- Search the default locations -->
+ <DefaultAppDirs/>
+
+ <Menu>
+ <Name>Applications</Name>
+ <Include>
+ <All/>
+ </Include>
+ </Menu>
+</Menu>
+EOF
+
+ # Install .desktop files
+ installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop
+}
diff --git a/menu/tests/tests/6/result b/menu/tests/tests/And/result
index dc159fa..dc159fa 100644
--- a/menu/tests/tests/6/result
+++ b/menu/tests/tests/And/result
diff --git a/menu/tests/tests/7/test b/menu/tests/tests/And/test
index ac4570f..31571db 100644
--- a/menu/tests/tests/7/test
+++ b/menu/tests/tests/And/test
@@ -1,8 +1,9 @@
-echo ">>> the <And> Keyword"
+TEST_PURPOSE="<And> Keyword"
-# Generate ${DIRTY_HACK}applications.menu
-mkdir -p ${XDG_CONFIG_DIR}/menus
-./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu <<EOF
+test_code() {
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
@@ -23,6 +24,6 @@ mkdir -p ${XDG_CONFIG_DIR}/menus
</Menu>
EOF
-
-# Install .desktop files
-installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop
+ # Install .desktop files
+ installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop
+}
diff --git a/menu/tests/tests/g/result b/menu/tests/tests/AppDir-relative/result
index 9e1d622..9e1d622 100644
--- a/menu/tests/tests/g/result
+++ b/menu/tests/tests/AppDir-relative/result
diff --git a/menu/tests/tests/AppDir-relative/test b/menu/tests/tests/AppDir-relative/test
new file mode 100644
index 0000000..75bd201
--- /dev/null
+++ b/menu/tests/tests/AppDir-relative/test
@@ -0,0 +1,27 @@
+TEST_PURPOSE="<AppDir> relative path tag ..."
+
+test_code() {
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+ <!-- Search the default locations -->
+ <AppDir>apps</AppDir>
+
+ <Menu>
+ <Name>Applications</Name>
+ <Include>
+ <Category>TextEditor</Category>
+ </Include>
+ </Menu>
+</Menu>
+EOF
+
+ # Install .desktop files
+ installData "${XDG_CONFIG_DIR}/menus/apps" kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop
+ installDataAs "${XDG_CONFIG_DIR}/menus/apps" kwrite.desktop should_be_ignored.notdesktop
+}
diff --git a/menu/tests/tests/AppDir/test b/menu/tests/tests/AppDir/test
new file mode 100644
index 0000000..8faff91
--- /dev/null
+++ b/menu/tests/tests/AppDir/test
@@ -0,0 +1,4 @@
+. tests/AppDir-relative/test
+export PATH_EXPANSION='${XDG_CONFIG_DIR}/menus/'
+TEST_PURPOSE="<AppDir> absolute path"
+
diff --git a/menu/tests/tests/1/result b/menu/tests/tests/Category/result
index 73b00c9..73b00c9 100644
--- a/menu/tests/tests/1/result
+++ b/menu/tests/tests/Category/result
diff --git a/menu/tests/tests/Category/test b/menu/tests/tests/Category/test
new file mode 100644
index 0000000..3ee0777
--- /dev/null
+++ b/menu/tests/tests/Category/test
@@ -0,0 +1,29 @@
+TEST_PURPOSE="<Category> tag"
+
+test_code() {
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+ <!-- Search the default locations -->
+ <DefaultAppDirs/>
+
+ <Menu>
+ <Name>Editors</Name>
+ <Include>
+ <Category>TextEditor</Category>
+ <!-- note it's lowercase, this is intentional to verify
+ it's a case sensitive implementation -->
+ <Category>application</Category>
+ </Include>
+ </Menu>
+</Menu>
+EOF
+
+# Install .desktop files, freecell is daft but intentional to verify category support is case sensitive
+installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop kate.desktop freecell.desktop
+}
diff --git a/menu/tests/tests/i/result b/menu/tests/tests/DefaultMergeDirs/result
index 9e17189..9e17189 100644
--- a/menu/tests/tests/i/result
+++ b/menu/tests/tests/DefaultMergeDirs/result
diff --git a/menu/tests/tests/i/test b/menu/tests/tests/DefaultMergeDirs/test
index 26c471e..3b570f2 100644
--- a/menu/tests/tests/i/test
+++ b/menu/tests/tests/DefaultMergeDirs/test
@@ -1,8 +1,9 @@
-echo ">>> the <DefaultMergeDirs> tag ..."
+TEST_PURPOSE="<DefaultMergeDirs> tag ..."
-# Generate ${DIRTY_HACK}applications.menu
-mkdir -p ${XDG_CONFIG_DIR}/menus
-./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu <<EOF
+test_code() {
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
@@ -20,9 +21,8 @@ mkdir -p ${XDG_CONFIG_DIR}/menus
</Menu>
EOF
-
-mkdir ${XDG_CONFIG_DIR}/menus/applications-merged/
-./expand > ${XDG_CONFIG_DIR}/menus/applications-merged/test.menu <<EOF
+ mkdir ${XDG_CONFIG_DIR}/menus/applications-merged/
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications-merged/test.menu <<EOF
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
@@ -38,5 +38,6 @@ mkdir ${XDG_CONFIG_DIR}/menus/applications-merged/
</Menu>
EOF
-# Install .desktop files
-installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop
+ # Install .desktop files
+ installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop
+}
diff --git a/menu/tests/tests/3/result b/menu/tests/tests/Deleted/result
index c121419..c121419 100644
--- a/menu/tests/tests/3/result
+++ b/menu/tests/tests/Deleted/result
diff --git a/menu/tests/tests/3/test b/menu/tests/tests/Deleted/test
index 2ec4ebc..db7a413 100644
--- a/menu/tests/tests/3/test
+++ b/menu/tests/tests/Deleted/test
@@ -1,8 +1,9 @@
-echo ">>> the <Deleted> tag"
+TEST_PURPOSE="<Deleted> tag"
-# Generate ${DIRTY_HACK}applications.menu
-mkdir -p ${XDG_CONFIG_DIR}/menus
-./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu <<EOF
+test_code() {
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
@@ -29,6 +30,6 @@ mkdir -p ${XDG_CONFIG_DIR}/menus
</Menu>
EOF
-
-# Install .desktop files
-installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop
+ # Install .desktop files
+ installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop
+}
diff --git a/menu/tests/tests/a/result b/menu/tests/tests/DesktopFileID/result
index 9629384..9629384 100644
--- a/menu/tests/tests/a/result
+++ b/menu/tests/tests/DesktopFileID/result
diff --git a/menu/tests/tests/DesktopFileID/test b/menu/tests/tests/DesktopFileID/test
new file mode 100644
index 0000000..ae2c679
--- /dev/null
+++ b/menu/tests/tests/DesktopFileID/test
@@ -0,0 +1,26 @@
+TEST_PURPOSE="DesktopFileIDs in submenus"
+
+test_code() {
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+ <!-- Search the default locations -->
+ <DefaultAppDirs/>
+
+ <Menu>
+ <Name>Applications</Name>
+ <Include>
+ <Category>Game</Category>
+ </Include>
+ </Menu>
+</Menu>
+EOF
+
+ # Install .desktop files
+ installData ${XDG_DATA_DIR}/applications/company/games gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop
+}
diff --git a/menu/tests/tests/c/result b/menu/tests/tests/Directory/result
index 2cd1d1f..2cd1d1f 100644
--- a/menu/tests/tests/c/result
+++ b/menu/tests/tests/Directory/result
diff --git a/menu/tests/tests/c/test b/menu/tests/tests/Directory/test
index 3751fab..fe7e126 100644
--- a/menu/tests/tests/c/test
+++ b/menu/tests/tests/Directory/test
@@ -1,8 +1,9 @@
-echo ">>> the <Directory> tag ..."
+TEST_PURPOSE="<Directory> tag ..."
-# Generate ${DIRTY_HACK}applications.menu
-mkdir -p ${XDG_CONFIG_DIR}/menus
-./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu <<EOF
+test_code() {
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
@@ -22,7 +23,7 @@ mkdir -p ${XDG_CONFIG_DIR}/menus
</Menu>
EOF
-
-# Install .desktop files
-installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop
-installData ${XDG_DATA_DIR}/desktop-directories apps.directory
+ # Install .desktop files
+ installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop
+ installData ${XDG_DATA_DIR}/desktop-directories apps.directory
+}
diff --git a/menu/tests/tests/h/result b/menu/tests/tests/DirectoryDir-relative/result
index 2cd1d1f..2cd1d1f 100644
--- a/menu/tests/tests/h/result
+++ b/menu/tests/tests/DirectoryDir-relative/result
diff --git a/menu/tests/tests/DirectoryDir-relative/test b/menu/tests/tests/DirectoryDir-relative/test
new file mode 100644
index 0000000..4a5e039
--- /dev/null
+++ b/menu/tests/tests/DirectoryDir-relative/test
@@ -0,0 +1,28 @@
+TEST_PURPOSE="relative <DirectoryDir> tag ..."
+
+test_code() {
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+ <!-- Search the default locations -->
+ <DefaultAppDirs/>
+ <DirectoryDir>${PATH_EXPANSION}desktop-directories</DirectoryDir>
+
+ <Menu>
+ <Name>Applications</Name>
+ <Directory>apps.directory</Directory>
+ <Include>
+ <Category>TextEditor</Category>
+ </Include>
+ </Menu>
+</Menu>
+EOF
+ # Install .desktop files
+ installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop
+ installData ${XDG_CONFIG_DIR}/menus/desktop-directories apps.directory
+}
diff --git a/menu/tests/tests/DirectoryDir/test b/menu/tests/tests/DirectoryDir/test
new file mode 100644
index 0000000..dc8bb3b
--- /dev/null
+++ b/menu/tests/tests/DirectoryDir/test
@@ -0,0 +1,4 @@
+. tests/DirectoryDir-relative/test
+export PATH_EXPANSION='${XDG_CONFIG_DIR}/menus/'
+TEST_PURPOSE="<DirectoryDir> absolute path"
+
diff --git a/menu/tests/tests/9/result b/menu/tests/tests/Exclude/result
index dfbb122..dfbb122 100644
--- a/menu/tests/tests/9/result
+++ b/menu/tests/tests/Exclude/result
diff --git a/menu/tests/tests/9/test b/menu/tests/tests/Exclude/test
index c3c6321..728ec99 100644
--- a/menu/tests/tests/9/test
+++ b/menu/tests/tests/Exclude/test
@@ -1,8 +1,9 @@
-echo ">>> the <Exclude> Keyword"
+TEST_PURPOSE="<Exclude> Keyword"
-# Generate ${DIRTY_HACK}applications.menu
-mkdir -p ${XDG_CONFIG_DIR}/menus
-./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu <<EOF
+test_code() {
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
@@ -26,6 +27,6 @@ mkdir -p ${XDG_CONFIG_DIR}/menus
</Menu>
EOF
-
-# Install .desktop files
-installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop
+ # Install .desktop files
+ installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop
+}
diff --git a/menu/tests/tests/7/result b/menu/tests/tests/Filename/result
index dc159fa..dc159fa 100644
--- a/menu/tests/tests/7/result
+++ b/menu/tests/tests/Filename/result
diff --git a/menu/tests/tests/6/test b/menu/tests/tests/Filename/test
index ef1d734..b9d021d 100644
--- a/menu/tests/tests/6/test
+++ b/menu/tests/tests/Filename/test
@@ -1,8 +1,9 @@
-echo ">>> the <Filename> tag"
+TEST_PURPOSE="<Filename> tag"
-# Generate ${DIRTY_HACK}applications.menu
-mkdir -p ${XDG_CONFIG_DIR}/menus
-./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu <<EOF
+test_code() {
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
@@ -20,6 +21,6 @@ mkdir -p ${XDG_CONFIG_DIR}/menus
</Menu>
EOF
-
-# Install .desktop files
-installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop
+ # Install .desktop files
+ installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop
+}
diff --git a/menu/tests/tests/w/result b/menu/tests/tests/LegacyDir-Move/result
index 9a2b9db..9a2b9db 100644
--- a/menu/tests/tests/w/result
+++ b/menu/tests/tests/LegacyDir-Move/result
diff --git a/menu/tests/tests/w/test b/menu/tests/tests/LegacyDir-Move/test
index 45fb03a..7e6e85e 100644
--- a/menu/tests/tests/w/test
+++ b/menu/tests/tests/LegacyDir-Move/test
@@ -1,11 +1,12 @@
-echo ">>> Move entries from <LegacyDir>"
+TEST_PURPOSE="move entries from <LegacyDir>"
-LEGACY_DIR=${MENUTESTDIR}/legacy_applnk
-export LEGACY_DIR
+test_code() {
+ LEGACY_DIR=${MENUTESTDIR}/legacy_applnk
+ export LEGACY_DIR
-# Generate ${DIRTY_HACK}applications.menu
-mkdir -p ${XDG_CONFIG_DIR}/menus
-./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu <<EOF
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
@@ -31,8 +32,8 @@ mkdir -p ${XDG_CONFIG_DIR}/menus
</Menu>
EOF
+ # Install .desktop files
-# Install .desktop files
-
-installData ${LEGACY_DIR} Home.desktop
-installData ${LEGACY_DIR}/Development gideon-legacy.desktop
+ installData ${LEGACY_DIR} Home.desktop
+ installData ${LEGACY_DIR}/Development gideon-legacy.desktop
+}
diff --git a/menu/tests/tests/e/result b/menu/tests/tests/LegacyDir-relative/result
index 0c2af9b..0c2af9b 100644
--- a/menu/tests/tests/e/result
+++ b/menu/tests/tests/LegacyDir-relative/result
diff --git a/menu/tests/tests/e/test b/menu/tests/tests/LegacyDir-relative/test
index 33303f4..5082590 100644
--- a/menu/tests/tests/e/test
+++ b/menu/tests/tests/LegacyDir-relative/test
@@ -1,11 +1,12 @@
-echo ">>> Simple <LegacyDir> test"
+TEST_PURPOSE="Simple <LegacyDir> test"
-LEGACY_DIR=${MENUTESTDIR}/legacy_applnk
-export LEGACY_DIR
+test_code() {
+ LEGACY_DIR=${MENUTESTDIR}/legacy_applnk
+ export LEGACY_DIR
-# Generate ${DIRTY_HACK}applications.menu
-mkdir -p ${XDG_CONFIG_DIR}/menus
-./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu <<EOF
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
@@ -33,13 +34,9 @@ mkdir -p ${XDG_CONFIG_DIR}/menus
</Menu>
EOF
-
-# Install .desktop files
-
-installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop kate.desktop
-
-installData ${LEGACY_DIR}/Development gideon-legacy.desktop kbabel.desktop quanta.desktop
-
-installData ${LEGACY_DIR} Kfind.desktop Home.desktop Help.desktop
-
+ # Install .desktop files
+ installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop kate.desktop
+ installData ${LEGACY_DIR}/Development gideon-legacy.desktop kbabel.desktop quanta.desktop
+ installData ${LEGACY_DIR} Kfind.desktop Home.desktop Help.desktop
+}
diff --git a/menu/tests/tests/y/result b/menu/tests/tests/Merge-combined/result
index 999bd1e..999bd1e 100644
--- a/menu/tests/tests/y/result
+++ b/menu/tests/tests/Merge-combined/result
diff --git a/menu/tests/tests/y/test b/menu/tests/tests/Merge-combined/test
index 1c20959..07cfab3 100644
--- a/menu/tests/tests/y/test
+++ b/menu/tests/tests/Merge-combined/test
@@ -1,11 +1,12 @@
-echo ">>> Merge Two Menus and a Legacy Menu"
+TEST_PURPOSE="Merge Two Menus and a Legacy Menu"
-LEGACY_DIR=${MENUTESTDIR}/legacy_applnk
-export LEGACY_DIR
+test_code() {
+ LEGACY_DIR=${MENUTESTDIR}/legacy_applnk
+ export LEGACY_DIR
-# Generate ${DIRTY_HACK}applications.menu
-mkdir -p ${XDG_CONFIG_DIR}/menus
-./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu <<EOF
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
@@ -38,8 +39,8 @@ mkdir -p ${XDG_CONFIG_DIR}/menus
</Menu>
EOF
+ # Install .desktop files
-# Install .desktop files
-
-installData ${LEGACY_DIR}/Development gideon-legacy.desktop
-installData ${XDG_DATA_DIR}/applications kate.desktop kwrite.desktop KEdit.desktop
+ installData ${LEGACY_DIR}/Development gideon-legacy.desktop
+ installData ${XDG_DATA_DIR}/applications kate.desktop kwrite.desktop KEdit.desktop
+}
diff --git a/menu/tests/tests/MergeDir-absolute/test b/menu/tests/tests/MergeDir-absolute/test
new file mode 100644
index 0000000..db6c895
--- /dev/null
+++ b/menu/tests/tests/MergeDir-absolute/test
@@ -0,0 +1,3 @@
+. tests/MergeDir-relative/test
+export PATH_EXPANSION='${XDG_CONFIG_DIR}/menus/'
+export TEST_PURPOSE="<MergeDir> absolute path test"
diff --git a/menu/tests/tests/j/result b/menu/tests/tests/MergeDir-relative/result
index 9e17189..9e17189 100644
--- a/menu/tests/tests/j/result
+++ b/menu/tests/tests/MergeDir-relative/result
diff --git a/menu/tests/tests/MergeDir-relative/test b/menu/tests/tests/MergeDir-relative/test
new file mode 100644
index 0000000..ba96b1a
--- /dev/null
+++ b/menu/tests/tests/MergeDir-relative/test
@@ -0,0 +1,61 @@
+TEST_PURPOSE="<MergeDir> relative path ..."
+
+test_code() {
+ # Generate applications.menu
+ mkdir -p "${XDG_CONFIG_DIR}/menus"
+ ./expand > "${XDG_CONFIG_DIR}/menus/applications.menu" <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+ <DefaultAppDirs/>
+ <MergeDir>${PATH_EXPANSION}applications-merged</MergeDir>
+
+ <Menu>
+ <Name>Applications</Name>
+ <Include>
+ <Category>TextEditor</Category>
+ </Include>
+ </Menu>
+</Menu>
+EOF
+
+ mkdir "${XDG_CONFIG_DIR}/menus/applications-merged/"
+ ./expand > "${XDG_CONFIG_DIR}/menus/applications-merged/test.menu" <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+
+ <Menu>
+ <Name>Development</Name>
+ <Include>
+ <Category>Development</Category>
+ </Include>
+ </Menu>
+</Menu>
+EOF
+
+ # intentional crap entry to verify it does _not_ get picked up
+ ./expand > "${XDG_CONFIG_DIR}/menus/applications-merged/dar.notmenu" <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+
+ <Menu>
+ <Name>testing</Name>
+ <Include>
+ <All/>
+ </Include>
+ </Menu>
+</Menu>
+EOF
+
+
+ # Install .desktop files
+ installData "${XDG_DATA_DIR}/applications" kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop
+}
diff --git a/menu/tests/tests/MergeFile-absolute/test b/menu/tests/tests/MergeFile-absolute/test
new file mode 100644
index 0000000..24cf669
--- /dev/null
+++ b/menu/tests/tests/MergeFile-absolute/test
@@ -0,0 +1,3 @@
+. tests/MergeFile-relative/test
+export PATH_EXPANSION='${XDG_CONFIG_DIR}/menus/'
+export TEST_PURPOSE="<MergeFile> absolute path"
diff --git a/menu/tests/tests/k/result b/menu/tests/tests/MergeFile-parent/result
index 9e17189..9e17189 100644
--- a/menu/tests/tests/k/result
+++ b/menu/tests/tests/MergeFile-parent/result
diff --git a/menu/tests/tests/q/test b/menu/tests/tests/MergeFile-parent/test
index 6e071c6..00ed006 100644
--- a/menu/tests/tests/q/test
+++ b/menu/tests/tests/MergeFile-parent/test
@@ -1,10 +1,11 @@
-echo ">>> the <MergeFile> tag ..."
+TEST_PURPOSE="<MergeFile> tag ..."
-# Tests the type attribute in <MergeFile>
+test_code() {
+ # Tests the type attribute in <MergeFile>
-# Generate ${DIRTY_HACK}applications.menu
-mkdir -p ${XDG_CONFIG_HOME}/menus
-./expand > ${XDG_CONFIG_HOME}/menus/${DIRTY_HACK}applications.menu <<EOF
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_HOME}/menus
+ ./expand > ${XDG_CONFIG_HOME}/menus/applications.menu <<EOF
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
@@ -22,9 +23,8 @@ mkdir -p ${XDG_CONFIG_HOME}/menus
</Menu>
EOF
-
-mkdir -p ${XDG_CONFIG_DIR}/menus
-./expand > ${XDG_CONFIG_DIR}/menus/test.menu <<EOF
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/test.menu <<EOF
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
@@ -40,7 +40,7 @@ mkdir -p ${XDG_CONFIG_DIR}/menus
</Menu>
EOF
-./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu <<EOF
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
@@ -56,5 +56,6 @@ EOF
</Menu>
EOF
-# Install .desktop files
-installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop freecell.desktop glines.desktop
+ # Install .desktop files
+ installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop freecell.desktop glines.desktop
+}
diff --git a/menu/tests/tests/r/result b/menu/tests/tests/MergeFile-path/result
index fbe635e..fbe635e 100644
--- a/menu/tests/tests/r/result
+++ b/menu/tests/tests/MergeFile-path/result
diff --git a/menu/tests/tests/r/test b/menu/tests/tests/MergeFile-path/test
index 6facb91..97daa5c 100644
--- a/menu/tests/tests/r/test
+++ b/menu/tests/tests/MergeFile-path/test
@@ -1,10 +1,11 @@
-echo ">>> the <MergeFile> tag ..."
+TEST_PURPOSE="<MergeFile> tag ..."
-# Tests the type attribute in <MergeFile>
+test_code() {
+ # Tests the type attribute in <MergeFile>
-# Generate ${DIRTY_HACK}applications.menu
-mkdir -p ${XDG_CONFIG_HOME}/menus
-./expand > ${XDG_CONFIG_HOME}/menus/${DIRTY_HACK}applications.menu <<EOF
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_HOME}/menus
+ ./expand > ${XDG_CONFIG_HOME}/menus/applications.menu <<EOF
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
@@ -22,9 +23,8 @@ mkdir -p ${XDG_CONFIG_HOME}/menus
</Menu>
EOF
-
-mkdir -p ${XDG_CONFIG_DIR}/menus
-./expand > ${XDG_CONFIG_DIR}/menus/test.menu <<EOF
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/test.menu <<EOF
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
@@ -40,7 +40,7 @@ mkdir -p ${XDG_CONFIG_DIR}/menus
</Menu>
EOF
-./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu <<EOF
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
@@ -56,5 +56,6 @@ EOF
</Menu>
EOF
-# Install .desktop files
-installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop freecell.desktop glines.desktop
+ # Install .desktop files
+ installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop freecell.desktop glines.desktop
+}
diff --git a/menu/tests/tests/l/result b/menu/tests/tests/MergeFile-recursive/result
index 9e17189..9e17189 100644
--- a/menu/tests/tests/l/result
+++ b/menu/tests/tests/MergeFile-recursive/result
diff --git a/menu/tests/tests/u/test b/menu/tests/tests/MergeFile-recursive/test
index 83e3700..4dbab21 100644
--- a/menu/tests/tests/u/test
+++ b/menu/tests/tests/MergeFile-recursive/test
@@ -1,10 +1,9 @@
-echo ">>> recursive <MergeFile>s ..."
+TEST_PURPOSE="test elaborate recursive look in <MergeFile>s"
-# Test elaborate recursive loop in <MergeFile>s
-
-# Generate ${DIRTY_HACK}applications.menu
-mkdir -p ${XDG_CONFIG_DIR}/menus
-./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu <<EOF
+test_code(){
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
@@ -23,8 +22,8 @@ mkdir -p ${XDG_CONFIG_DIR}/menus
EOF
-mkdir ${XDG_CONFIG_DIR}/menus/applications-merged/
-./expand > ${XDG_CONFIG_DIR}/menus/applications-merged/test.menu <<EOF
+ mkdir ${XDG_CONFIG_DIR}/menus/applications-merged/
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications-merged/test.menu <<EOF
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
@@ -35,8 +34,8 @@ mkdir ${XDG_CONFIG_DIR}/menus/applications-merged/
</Menu>
EOF
-mkdir ${XDG_CONFIG_DIR}/menus/applications-merged/extra/
-./expand > ${XDG_CONFIG_DIR}/menus/applications-merged/extra/test.menu <<EOF
+ mkdir ${XDG_CONFIG_DIR}/menus/applications-merged/extra/
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications-merged/extra/test.menu <<EOF
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
@@ -54,5 +53,6 @@ mkdir ${XDG_CONFIG_DIR}/menus/applications-merged/extra/
</Menu>
EOF
-# Install .desktop files
-installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop
+ # Install .desktop files
+ installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop
+}
diff --git a/menu/tests/tests/p/result b/menu/tests/tests/MergeFile-relative/result
index 9e17189..9e17189 100644
--- a/menu/tests/tests/p/result
+++ b/menu/tests/tests/MergeFile-relative/result
diff --git a/menu/tests/tests/k/test b/menu/tests/tests/MergeFile-relative/test
index 2a037b7..c3478db 100644
--- a/menu/tests/tests/k/test
+++ b/menu/tests/tests/MergeFile-relative/test
@@ -1,15 +1,16 @@
-echo ">>> the <MergeFile> tag ..."
+TEST_PURPOSE="<MergeFile> tag relative path"
-# Generate ${DIRTY_HACK}applications.menu
-mkdir -p ${XDG_CONFIG_DIR}/menus
-./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu <<EOF
+test_code(){
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
<Menu>
<Name>KDE</Name>
<DefaultAppDirs/>
- <MergeFile>applications-merged/test.menu</MergeFile>
+ <MergeFile>${PATH_EXPANSION}applications-merged/test.menu</MergeFile>
<Menu>
<Name>Applications</Name>
@@ -20,9 +21,8 @@ mkdir -p ${XDG_CONFIG_DIR}/menus
</Menu>
EOF
-
-mkdir ${XDG_CONFIG_DIR}/menus/applications-merged/
-./expand > ${XDG_CONFIG_DIR}/menus/applications-merged/test.menu <<EOF
+ mkdir ${XDG_CONFIG_DIR}/menus/applications-merged/
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications-merged/test.menu <<EOF
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
<!-- test -->
@@ -39,5 +39,6 @@ mkdir ${XDG_CONFIG_DIR}/menus/applications-merged/
</Menu>
EOF
-# Install .desktop files
-installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop
+ # Install .desktop files
+ installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop
+}
diff --git a/menu/tests/tests/q/result b/menu/tests/tests/MergeFile2/result
index 9e17189..9e17189 100644
--- a/menu/tests/tests/q/result
+++ b/menu/tests/tests/MergeFile2/result
diff --git a/menu/tests/tests/l/test b/menu/tests/tests/MergeFile2/test
index 3d6bfcd..e5b1591 100644
--- a/menu/tests/tests/l/test
+++ b/menu/tests/tests/MergeFile2/test
@@ -1,10 +1,11 @@
-echo ">>> the <MergeFile> tag ..."
+TEST_PURPOSE="<MergeFile> tag ..."
-# Tests the use of relative paths in <MergeFile>
+test_code() {
+ # Tests the use of relative paths in <MergeFile>
-# Generate ${DIRTY_HACK}applications.menu
-mkdir -p ${XDG_CONFIG_DIR}/menus
-./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu <<EOF
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
@@ -22,9 +23,8 @@ mkdir -p ${XDG_CONFIG_DIR}/menus
</Menu>
EOF
-
-mkdir ${XDG_CONFIG_DIR}/menus/applications-merged/
-./expand > ${XDG_CONFIG_DIR}/menus/applications-merged/test.menu <<EOF
+ mkdir ${XDG_CONFIG_DIR}/menus/applications-merged/
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications-merged/test.menu <<EOF
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
@@ -35,8 +35,8 @@ mkdir ${XDG_CONFIG_DIR}/menus/applications-merged/
</Menu>
EOF
-mkdir ${XDG_CONFIG_DIR}/menus/applications-merged/extra/
-./expand > ${XDG_CONFIG_DIR}/menus/applications-merged/extra/test.menu <<EOF
+ mkdir ${XDG_CONFIG_DIR}/menus/applications-merged/extra/
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications-merged/extra/test.menu <<EOF
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
@@ -52,5 +52,6 @@ mkdir ${XDG_CONFIG_DIR}/menus/applications-merged/extra/
</Menu>
EOF
-# Install .desktop files
-installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop
+ # Install .desktop files
+ installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop
+}
diff --git a/menu/tests/tests/u/result b/menu/tests/tests/MergeFile3/result
index 9e17189..9e17189 100644
--- a/menu/tests/tests/u/result
+++ b/menu/tests/tests/MergeFile3/result
diff --git a/menu/tests/tests/p/test b/menu/tests/tests/MergeFile3/test
index 3341eec..8781888 100644
--- a/menu/tests/tests/p/test
+++ b/menu/tests/tests/MergeFile3/test
@@ -1,10 +1,11 @@
-echo ">>> the <MergeFile> tag ..."
+TEST_PURPOSE="<MergeFile> tag ..."
-# Tests the use of relative paths in <MergeFile>
+test_code() {
+ # Tests the use of relative paths in <MergeFile>
-# Generate ${DIRTY_HACK}applications.menu
-mkdir -p ${XDG_CONFIG_DIR}/menus
-./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu <<EOF
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
@@ -22,8 +23,7 @@ mkdir -p ${XDG_CONFIG_DIR}/menus
</Menu>
EOF
-
-./expand > ${XDG_CONFIG_DIR}/menus/test.menu <<EOF
+ ./expand > ${XDG_CONFIG_DIR}/menus/test.menu <<EOF
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
@@ -34,8 +34,8 @@ EOF
</Menu>
EOF
-mkdir ${XDG_CONFIG_DIR}/menus/extra/
-./expand > ${XDG_CONFIG_DIR}/menus/extra/test.menu <<EOF
+ mkdir ${XDG_CONFIG_DIR}/menus/extra/
+ ./expand > ${XDG_CONFIG_DIR}/menus/extra/test.menu <<EOF
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
@@ -51,5 +51,6 @@ mkdir ${XDG_CONFIG_DIR}/menus/extra/
</Menu>
EOF
-# Install .desktop files
-installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop
+ # Install .desktop files
+ installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop
+}
diff --git a/menu/tests/tests/f/result b/menu/tests/tests/Move-collapsing/result
index 10ccec6..10ccec6 100644
--- a/menu/tests/tests/f/result
+++ b/menu/tests/tests/Move-collapsing/result
diff --git a/menu/tests/tests/f/test b/menu/tests/tests/Move-collapsing/test
index 5d673d8..b842b0a 100644
--- a/menu/tests/tests/f/test
+++ b/menu/tests/tests/Move-collapsing/test
@@ -1,8 +1,9 @@
-echo ">>> a complicated <Move> operation"
+TEST_PURPOSE="complicated <Move> operation"
-# Generate ${DIRTY_HACK}applications.menu
-mkdir -p ${XDG_CONFIG_DIR}/menus
-./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu <<EOF
+test_code() {
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
@@ -34,6 +35,6 @@ mkdir -p ${XDG_CONFIG_DIR}/menus
</Menu>
EOF
-
-# Install .desktop files
-installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop
+ # Install .desktop files
+ installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop
+}
diff --git a/menu/tests/tests/t/result b/menu/tests/tests/Move-ordering/result
index b941f58..b941f58 100644
--- a/menu/tests/tests/t/result
+++ b/menu/tests/tests/Move-ordering/result
diff --git a/menu/tests/tests/t/test b/menu/tests/tests/Move-ordering/test
index bbe7568..f8883b9 100644
--- a/menu/tests/tests/t/test
+++ b/menu/tests/tests/Move-ordering/test
@@ -1,10 +1,11 @@
-echo ">>> Order of <Move> operations ..."
+TEST_PURPOSE="Order of <Move> operations ..."
-# Tests the type attribute in <MergeFile>
+test_code() {
+ # Tests the type attribute in <MergeFile>
-# Generate ${DIRTY_HACK}applications.menu
-mkdir -p ${XDG_CONFIG_DIR}/menus
-./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu <<EOF
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
@@ -41,7 +42,8 @@ mkdir -p ${XDG_CONFIG_DIR}/menus
</Menu>
EOF
-# Move operations in sub-menus should be performed first
+ # Move operations in sub-menus should be performed first
-# Install .desktop files
-installData ${XDG_DATA_DIR}/applications freecell.desktop glines.desktop gideon.desktop
+ # Install .desktop files
+ installData ${XDG_DATA_DIR}/applications freecell.desktop glines.desktop gideon.desktop
+}
diff --git a/menu/tests/tests/x/result b/menu/tests/tests/Move-submenu/result
index f1c44ef..f1c44ef 100644
--- a/menu/tests/tests/x/result
+++ b/menu/tests/tests/Move-submenu/result
diff --git a/menu/tests/tests/x/test b/menu/tests/tests/Move-submenu/test
index bc5ff47..2751983 100644
--- a/menu/tests/tests/x/test
+++ b/menu/tests/tests/Move-submenu/test
@@ -1,8 +1,9 @@
-echo ">>> Move into a new Submenu"
+TEST_PURPOSE="Move into a new Submenu"
-# Generate ${DIRTY_HACK}applications.menu
-mkdir -p ${XDG_CONFIG_DIR}/menus
-./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu <<EOF
+test_code() {
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
@@ -25,7 +26,7 @@ mkdir -p ${XDG_CONFIG_DIR}/menus
</Menu>
EOF
+ # Install .desktop files
-# Install .desktop files
-
-installData ${XDG_DATA_DIR}/applications gideon-legacy.desktop
+ installData ${XDG_DATA_DIR}/applications gideon-legacy.desktop
+}
diff --git a/menu/tests/tests/4/result b/menu/tests/tests/Move/result
index d9a802d..d9a802d 100644
--- a/menu/tests/tests/4/result
+++ b/menu/tests/tests/Move/result
diff --git a/menu/tests/tests/4/test b/menu/tests/tests/Move/test
index 9468b0a..9f2d162 100644
--- a/menu/tests/tests/4/test
+++ b/menu/tests/tests/Move/test
@@ -1,8 +1,9 @@
-echo ">>> a simple <Move> operation"
+TEST_PURPOSE="simple <Move> operation"
-# Generate ${DIRTY_HACK}applications.menu
-mkdir -p ${XDG_CONFIG_DIR}/menus
-./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu <<EOF
+test_code() {
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
@@ -28,6 +29,6 @@ mkdir -p ${XDG_CONFIG_DIR}/menus
</Menu>
EOF
-
-# Install .desktop files
-installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop
+ # Install .desktop files
+ installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop
+}
diff --git a/menu/tests/tests/m/result b/menu/tests/tests/NoDisplay/result
index 7ed7169..7ed7169 100644
--- a/menu/tests/tests/m/result
+++ b/menu/tests/tests/NoDisplay/result
diff --git a/menu/tests/tests/m/test b/menu/tests/tests/NoDisplay/test
index 352885e..48e94ea 100644
--- a/menu/tests/tests/m/test
+++ b/menu/tests/tests/NoDisplay/test
@@ -1,8 +1,9 @@
-echo ">>> NoDisplay desktop entry values"
+TEST_PURPOSE="NoDisplay desktop entry values"
-# Generate ${DIRTY_HACK}applications.menu
-mkdir -p ${XDG_CONFIG_DIR}/menus
-./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu <<EOF
+test_code() {
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
@@ -30,6 +31,7 @@ mkdir -p ${XDG_CONFIG_DIR}/menus
</Menu>
EOF
-# Install .desktop files
-installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop kate.desktop freecell.desktop hidden.desktop
-installData ${XDG_DATA_DIR}/desktop-directories hidden.directory
+ # Install .desktop files
+ installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop kate.desktop freecell.desktop hidden.desktop
+ installData ${XDG_DATA_DIR}/desktop-directories hidden.directory
+}
diff --git a/menu/tests/tests/n/result b/menu/tests/tests/NoDisplay2/result
index 7ed7169..7ed7169 100644
--- a/menu/tests/tests/n/result
+++ b/menu/tests/tests/NoDisplay2/result
diff --git a/menu/tests/tests/n/test b/menu/tests/tests/NoDisplay2/test
index 7088e16..62ba5a7 100644
--- a/menu/tests/tests/n/test
+++ b/menu/tests/tests/NoDisplay2/test
@@ -1,8 +1,9 @@
-echo ">>> Allocation of desktop entry values from deleted menus"
+TEST_PURPOSE="Allocation of desktop entry values from deleted menus"
-# Generate ${DIRTY_HACK}applications.menu
-mkdir -p ${XDG_CONFIG_DIR}/menus
-./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu <<EOF
+test_code() {
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
@@ -31,6 +32,7 @@ mkdir -p ${XDG_CONFIG_DIR}/menus
</Menu>
EOF
-# Install .desktop files
-installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop kate.desktop freecell.desktop hidden.desktop
-installData ${XDG_DATA_DIR}/desktop-directories apps.directory
+ # Install .desktop files
+ installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop kate.desktop freecell.desktop hidden.desktop
+ installData ${XDG_DATA_DIR}/desktop-directories apps.directory
+}
diff --git a/menu/tests/tests/v/result b/menu/tests/tests/NotOnlyUnallocated-default/result
index 0c398b7..0c398b7 100644
--- a/menu/tests/tests/v/result
+++ b/menu/tests/tests/NotOnlyUnallocated-default/result
diff --git a/menu/tests/tests/v/test b/menu/tests/tests/NotOnlyUnallocated-default/test
index 5fb6103..2f4956e 100644
--- a/menu/tests/tests/v/test
+++ b/menu/tests/tests/NotOnlyUnallocated-default/test
@@ -1,10 +1,11 @@
-echo ">>> Another <OnlyUnallocated> test"
+TEST_PURPOSE="Another <OnlyUnallocated> test"
-# Tests <OnlyUnallocated>
+test_code() {
+ # Tests <OnlyUnallocated>
-# Generate ${DIRTY_HACK}applications.menu
-mkdir -p ${XDG_CONFIG_DIR}/menus
-./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu <<EOF
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
@@ -27,5 +28,6 @@ mkdir -p ${XDG_CONFIG_DIR}/menus
</Menu>
EOF
-# Install .desktop files
-installData ${XDG_DATA_DIR}/applications kwrite.desktop
+ # Install .desktop files
+ installData ${XDG_DATA_DIR}/applications kwrite.desktop
+}
diff --git a/menu/tests/tests/2/result b/menu/tests/tests/OnlyUnallocated/result
index 8be4bc7..8be4bc7 100644
--- a/menu/tests/tests/2/result
+++ b/menu/tests/tests/OnlyUnallocated/result
diff --git a/menu/tests/tests/2/test b/menu/tests/tests/OnlyUnallocated/test
index 7e28af5..efda0ff 100644
--- a/menu/tests/tests/2/test
+++ b/menu/tests/tests/OnlyUnallocated/test
@@ -1,8 +1,9 @@
-echo ">>> the <OnlyAllocated> tag"
+TEST_PURPOSE="<OnlyAllocated> tag"
-# Generate ${DIRTY_HACK}applications.menu
-mkdir -p ${XDG_CONFIG_DIR}/menus
-./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu <<EOF
+test_code() {
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
@@ -38,5 +39,6 @@ mkdir -p ${XDG_CONFIG_DIR}/menus
EOF
-# Install .desktop files
-installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop
+ # Install .desktop files
+ installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop
+}
diff --git a/menu/tests/tests/8/result b/menu/tests/tests/Or/result
index fc75a82..fc75a82 100644
--- a/menu/tests/tests/8/result
+++ b/menu/tests/tests/Or/result
diff --git a/menu/tests/tests/8/test b/menu/tests/tests/Or/test
index 4554d05..cd10cfd 100644
--- a/menu/tests/tests/8/test
+++ b/menu/tests/tests/Or/test
@@ -1,8 +1,9 @@
-echo ">>> the <Or> Keyword"
+TEST_PURPOSE="<Or> Keyword"
-# Generate ${DIRTY_HACK}applications.menu
-mkdir -p ${XDG_CONFIG_DIR}/menus
-./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu <<EOF
+test_code() {
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
@@ -23,6 +24,6 @@ mkdir -p ${XDG_CONFIG_DIR}/menus
</Menu>
EOF
-
-# Install .desktop files
-installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop
+ # Install .desktop files
+ installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop
+}
diff --git a/menu/tests/tests/a/test b/menu/tests/tests/a/test
deleted file mode 100644
index 232704b..0000000
--- a/menu/tests/tests/a/test
+++ /dev/null
@@ -1,25 +0,0 @@
-echo ">>> a test for DesktopFileIDs in submenus"
-
-# Generate ${DIRTY_HACK}applications.menu
-mkdir -p ${XDG_CONFIG_DIR}/menus
-./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu <<EOF
- <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
- "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
-
-<Menu>
- <Name>KDE</Name>
- <!-- Search the default locations -->
- <DefaultAppDirs/>
-
- <Menu>
- <Name>Applications</Name>
- <Include>
- <Category>Game</Category>
- </Include>
- </Menu>
-</Menu>
-EOF
-
-
-# Install .desktop files
-installData ${XDG_DATA_DIR}/applications/company/games gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop
diff --git a/menu/tests/tests/o/result b/menu/tests/tests/boolean-logic/result
index ea47f01..ea47f01 100644
--- a/menu/tests/tests/o/result
+++ b/menu/tests/tests/boolean-logic/result
diff --git a/menu/tests/tests/boolean-logic/test b/menu/tests/tests/boolean-logic/test
new file mode 100644
index 0000000..dc045c4
--- /dev/null
+++ b/menu/tests/tests/boolean-logic/test
@@ -0,0 +1,36 @@
+TEST_PURPOSE="<And><Category>foo</Category><Not><Category>foo</Category></Not></And> shouldn't match anything"
+
+test_code() {
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+
+ <DefaultAppDirs/>
+ <DefaultDirectoryDirs/>
+
+ <Menu>
+ <Name>Applications</Name>
+ <Directory>apps.directory</Directory>
+ <Include>
+ <Or>
+ <Category>TextEditor</Category>
+ <And>
+ <Category>Game</Category>
+ <Not><Category>Game</Category></Not>
+ </And>
+ </Or>
+ </Include>
+ </Menu>
+</Menu>
+EOF
+
+ # Install .desktop files
+ installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop kate.desktop
+ installData ${XDG_DATA_DIR}/applications/test freecell.desktop
+ installData ${XDG_DATA_DIR}/desktop-directories apps.directory
+}
diff --git a/menu/tests/tests/s/result b/menu/tests/tests/desktop-name-collision/result
index e1e9221..e1e9221 100644
--- a/menu/tests/tests/s/result
+++ b/menu/tests/tests/desktop-name-collision/result
diff --git a/menu/tests/tests/desktop-name-collision/test b/menu/tests/tests/desktop-name-collision/test
new file mode 100644
index 0000000..46b5ded
--- /dev/null
+++ b/menu/tests/tests/desktop-name-collision/test
@@ -0,0 +1,53 @@
+TEST_PURPOSE=".desktop files with same name ..."
+
+test_code() {
+ # Tests the type attribute in <MergeFile>
+
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
+ <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+ "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
+
+<Menu>
+ <Name>KDE</Name>
+ <DefaultAppDirs/>
+ <Menu>
+ <Name>Games</Name>
+ <Include>
+ <Category>Game</Category>
+ </Include>
+ </Menu>
+ <Menu>
+ <Name>Development</Name>
+ <Include>
+ <Category>Development</Category>
+ </Include>
+ </Menu>
+</Menu>
+EOF
+
+ # Install .desktop files
+ installData ${XDG_DATA_DIR}/applications freecell.desktop glines.desktop mahjongg.desktop
+
+ # freecell.desktop is installed twice, only the version under ${XDG_DATA_HOME}/applications
+ # should show up in the menu
+ # freecell.desktop in ${XDG_DATA_DIR}/applications should be ignored.
+ installData ${XDG_DATA_HOME}/applications freecell.desktop
+
+ # ${XDG_DATA_HOME}/applications/glines.desktop has NoDisplay=true
+ # glines.desktop should not be shown
+ # glines.desktop in ${XDG_DATA_DIR}/applications should be ignored.
+ installDataAs ${XDG_DATA_HOME}/applications glines-2.desktop glines.desktop
+
+ # ${XDG_DATA_HOME}/applications/mahjongg.desktop has Categories=Development
+ # mahjongg.desktop should be shown under the Development menu
+ # mahjongg.desktop in ${XDG_DATA_DIR}/applications should be ignored.
+ installDataAs ${XDG_DATA_HOME}/applications mahjongg-2.desktop mahjongg.desktop
+
+ # kde/gideon.desktop and kde-gideon.desktop are equivalent
+ # only the version under ${XDG_DATA_HOME}/applications should show up in the menu
+ # gideon.desktop in ${XDG_DATA_DIR}/applications/kde should be ignored.
+ installDataAs ${XDG_DATA_DIR}/applications/kde gideon.desktop
+ installDataAs ${XDG_DATA_HOME}/applications gideon.desktop kde-gideon.desktop
+}
diff --git a/menu/tests/tests/g/test b/menu/tests/tests/g/test
deleted file mode 100644
index eb75f2e..0000000
--- a/menu/tests/tests/g/test
+++ /dev/null
@@ -1,25 +0,0 @@
-echo ">>> a relative <AppDir> tag ..."
-
-# Generate ${DIRTY_HACK}applications.menu
-mkdir -p ${XDG_CONFIG_DIR}/menus
-./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu <<EOF
- <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
- "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
-
-<Menu>
- <Name>KDE</Name>
- <!-- Search the default locations -->
- <AppDir>apps</AppDir>
-
- <Menu>
- <Name>Applications</Name>
- <Include>
- <Category>TextEditor</Category>
- </Include>
- </Menu>
-</Menu>
-EOF
-
-
-# Install .desktop files
-installData ${XDG_CONFIG_DIR}/menus/apps kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop
diff --git a/menu/tests/tests/h/test b/menu/tests/tests/h/test
deleted file mode 100644
index c8fa0cc..0000000
--- a/menu/tests/tests/h/test
+++ /dev/null
@@ -1,28 +0,0 @@
-echo ">>> a relative <DirectoryDir> tag ..."
-
-# Generate ${DIRTY_HACK}applications.menu
-mkdir -p ${XDG_CONFIG_DIR}/menus
-./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu <<EOF
- <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
- "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
-
-<Menu>
- <Name>KDE</Name>
- <!-- Search the default locations -->
- <DefaultAppDirs/>
- <DirectoryDir>desktop-directories</DirectoryDir>
-
- <Menu>
- <Name>Applications</Name>
- <Directory>apps.directory</Directory>
- <Include>
- <Category>TextEditor</Category>
- </Include>
- </Menu>
-</Menu>
-EOF
-
-
-# Install .desktop files
-installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop
-installData ${XDG_CONFIG_DIR}/menus/desktop-directories apps.directory
diff --git a/menu/tests/tests/j/test b/menu/tests/tests/j/test
deleted file mode 100644
index 077d952..0000000
--- a/menu/tests/tests/j/test
+++ /dev/null
@@ -1,42 +0,0 @@
-echo ">>> the <MergeDir> tag ..."
-
-# Generate ${DIRTY_HACK}applications.menu
-mkdir -p ${XDG_CONFIG_DIR}/menus
-./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu <<EOF
- <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
- "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
-
-<Menu>
- <Name>KDE</Name>
- <DefaultAppDirs/>
- <MergeDir>applications-merged</MergeDir>
-
- <Menu>
- <Name>Applications</Name>
- <Include>
- <Category>TextEditor</Category>
- </Include>
- </Menu>
-</Menu>
-EOF
-
-
-mkdir ${XDG_CONFIG_DIR}/menus/applications-merged/
-./expand > ${XDG_CONFIG_DIR}/menus/applications-merged/test.menu <<EOF
- <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
- "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
-
-<Menu>
- <Name>KDE</Name>
-
- <Menu>
- <Name>Development</Name>
- <Include>
- <Category>Development</Category>
- </Include>
- </Menu>
-</Menu>
-EOF
-
-# Install .desktop files
-installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop
diff --git a/menu/tests/tests/b/result b/menu/tests/tests/menu-multiple-matching/result
index 986c873..986c873 100644
--- a/menu/tests/tests/b/result
+++ b/menu/tests/tests/menu-multiple-matching/result
diff --git a/menu/tests/tests/b/test b/menu/tests/tests/menu-multiple-matching/test
index 74d9870..d8914ab 100644
--- a/menu/tests/tests/b/test
+++ b/menu/tests/tests/menu-multiple-matching/test
@@ -1,8 +1,9 @@
-echo ">>> a complicated rule ..."
+TEST_PURPOSE="complicated rule ..."
-# Generate ${DIRTY_HACK}applications.menu
-mkdir -p ${XDG_CONFIG_DIR}/menus
-./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu <<EOF
+test_code() {
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
@@ -30,6 +31,6 @@ mkdir -p ${XDG_CONFIG_DIR}/menus
</Menu>
EOF
-
-# Install .desktop files
-installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop
+ # Install .desktop files
+ installData ${XDG_DATA_DIR}/applications gataxx.desktop mahjongg.desktop freecell.desktop glines.desktop kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop
+}
diff --git a/menu/tests/tests/o/test b/menu/tests/tests/o/test
deleted file mode 100644
index b87f321..0000000
--- a/menu/tests/tests/o/test
+++ /dev/null
@@ -1,34 +0,0 @@
-echo ">>> <And><Category>foo</Category><Not><Category>foo</Category></Not></And> shouldn't match anything"
-
-# Generate ${DIRTY_HACK}applications.menu
-mkdir -p ${XDG_CONFIG_DIR}/menus
-./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu <<EOF
- <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
- "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
-
-<Menu>
- <Name>KDE</Name>
-
- <DefaultAppDirs/>
- <DefaultDirectoryDirs/>
-
- <Menu>
- <Name>Applications</Name>
- <Directory>apps.directory</Directory>
- <Include>
- <Or>
- <Category>TextEditor</Category>
- <And>
- <Category>Game</Category>
- <Not><Category>Game</Category></Not>
- </And>
- </Or>
- </Include>
- </Menu>
-</Menu>
-EOF
-
-# Install .desktop files
-installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop kate.desktop
-installData ${XDG_DATA_DIR}/applications/test freecell.desktop
-installData ${XDG_DATA_DIR}/desktop-directories apps.directory
diff --git a/menu/tests/tests/official-categories/categories.list b/menu/tests/tests/official-categories/categories.list
new file mode 100644
index 0000000..6e2198d
--- /dev/null
+++ b/menu/tests/tests/official-categories/categories.list
@@ -0,0 +1,10 @@
+AudioVideo
+Development
+Education
+Game
+Graphics
+Network
+Office
+Settings
+System
+Utility
diff --git a/menu/tests/tests/official-categories/test b/menu/tests/tests/official-categories/test
new file mode 100644
index 0000000..09621cd
--- /dev/null
+++ b/menu/tests/tests/official-categories/test
@@ -0,0 +1,73 @@
+TEST_PURPOSE="verify all required categories are supported"
+
+base_loc="tests/official-categories"
+
+test_code()
+{
+ local category
+ for category in $(< "${base_loc}/categories.list"); do
+ CATEGORY="${category}" ./expand "${base_loc}/unique-entry.desktop" > "data/${category}.desktop"
+ installData "${XDG_DATA_DIR}/applications" "${category}.desktop"
+ rm "data/${category}.desktop"
+ done
+}
+
+query()
+{
+ echo "$@"
+ ret=''
+ while [ -z "$ret" ]; do
+ echo -n "y/n? :"
+ read ret
+ if ! [ "$ret" == "y" -o "$ret" == "n" ]; then
+ echo "invalid response; must be 'y' or 'n'"
+ ret=''
+ fi
+ done
+ [ "$ret" == "y" ] && return 0
+ return 1
+}
+
+interpret_results()
+{
+ # inefficient, but works.
+ local missed=''
+ local correct=''
+ for category in $(< "${base_loc}/categories.list"); do
+ if grep "/${category}\.desktop" "${MENUTESTDIR}/run-result" > /dev/null; then
+ correct="${correct} ${category}"
+ else
+ missed="${missed} ${category}"
+ fi
+ done
+ if [ -z "${missed}" ]; then
+ echo ">>> OK"
+ return 0
+ fi
+ if [ "$(echo $missed)" != "Settings" ]; then
+ # failures.
+ cat "${MENUTESTDIR}/run-result"
+ echo "missed categories $missed"
+ echo "matched ${correct}"
+ echo ">>> Failed (missed $(echo $missed | wc -w) out of $(wc -l "${base_loc}/categories.list")"
+ return 1
+ fi
+ echo ">>> Settings failed; checking interactively"
+ local ret
+ if [ "$(id -u)" != "0" ]; then
+ echo ">>> Cannot go interactive due to test being ran as non-root; re-run as root"
+ return 1;
+ elif ! which xdg-desktop-menu &> /dev/null; then
+ echo ">>> xdg-desktop-menu is not available; cannot do interactive test"
+ return 1;
+ fi
+ xdg-desktop-menu install --mode system --novendor "${XDG_DATA_DIR}/applications/Settings.desktop"
+ (
+ query "Please check for a 'menu-spec-testing' in any gnome/kde system settings panel"
+ )
+ ret=$?
+ xdg-desktop-menu uninstall --mode system "${XDG_DATA_DIR}/applications/Settings.desktop"
+ return $(($ret))
+}
+
+MODE=system_data
diff --git a/menu/tests/tests/official-categories/unique-entry.desktop b/menu/tests/tests/official-categories/unique-entry.desktop
new file mode 100644
index 0000000..6ee3b88
--- /dev/null
+++ b/menu/tests/tests/official-categories/unique-entry.desktop
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Encoding=UTF-8
+Name=menu-spec-testing
+Exec=true
+Icon=quanta
+Type=Application
+MimeType=text/html
+Comment=menu-spec testing
+Categories=${CATEGORY};
diff --git a/menu/tests/tests/s/test b/menu/tests/tests/s/test
deleted file mode 100644
index a68b646..0000000
--- a/menu/tests/tests/s/test
+++ /dev/null
@@ -1,51 +0,0 @@
-echo ">>> .desktop files with same name ..."
-
-# Tests the type attribute in <MergeFile>
-
-# Generate ${DIRTY_HACK}applications.menu
-mkdir -p ${XDG_CONFIG_DIR}/menus
-./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu <<EOF
- <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
- "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
-
-<Menu>
- <Name>KDE</Name>
- <DefaultAppDirs/>
- <Menu>
- <Name>Games</Name>
- <Include>
- <Category>Game</Category>
- </Include>
- </Menu>
- <Menu>
- <Name>Development</Name>
- <Include>
- <Category>Development</Category>
- </Include>
- </Menu>
-</Menu>
-EOF
-
-# Install .desktop files
-installData ${XDG_DATA_DIR}/applications freecell.desktop glines.desktop mahjongg.desktop
-
-# freecell.desktop is installed twice, only the version under ${XDG_DATA_HOME}/applications
-# should show up in the menu
-# freecell.desktop in ${XDG_DATA_DIR}/applications should be ignored.
-installData ${XDG_DATA_HOME}/applications freecell.desktop
-
-# ${XDG_DATA_HOME}/applications/glines.desktop has NoDisplay=true
-# glines.desktop should not be shown
-# glines.desktop in ${XDG_DATA_DIR}/applications should be ignored.
-installDataAs ${XDG_DATA_HOME}/applications glines-2.desktop glines.desktop
-
-# ${XDG_DATA_HOME}/applications/mahjongg.desktop has Categories=Development
-# mahjongg.desktop should be shown under the Development menu
-# mahjongg.desktop in ${XDG_DATA_DIR}/applications should be ignored.
-installDataAs ${XDG_DATA_HOME}/applications mahjongg-2.desktop mahjongg.desktop
-
-# kde/gideon.desktop and kde-gideon.desktop are equivalent
-# only the version under ${XDG_DATA_HOME}/applications should show up in the menu
-# gideon.desktop in ${XDG_DATA_DIR}/applications/kde should be ignored.
-installDataAs ${XDG_DATA_DIR}/applications/kde gideon.desktop
-installDataAs ${XDG_DATA_HOME}/applications gideon.desktop kde-gideon.desktop
diff --git a/menu/tests/tests/d/result b/menu/tests/tests/submenu-collision/result
index 6aa47d7..6aa47d7 100644
--- a/menu/tests/tests/d/result
+++ b/menu/tests/tests/submenu-collision/result
diff --git a/menu/tests/tests/d/test b/menu/tests/tests/submenu-collision/test
index 33b6dc6..7d29896 100644
--- a/menu/tests/tests/d/test
+++ b/menu/tests/tests/submenu-collision/test
@@ -1,8 +1,9 @@
-echo ">>> two submenus with the same name ..."
+TEST_PURPOSE="two submenus with the same name ..."
-# Generate ${DIRTY_HACK}applications.menu
-mkdir -p ${XDG_CONFIG_DIR}/menus
-./expand > ${XDG_CONFIG_DIR}/menus/${DIRTY_HACK}applications.menu <<EOF
+test_code() {
+ # Generate applications.menu
+ mkdir -p ${XDG_CONFIG_DIR}/menus
+ ./expand > ${XDG_CONFIG_DIR}/menus/applications.menu <<EOF
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
@@ -26,6 +27,6 @@ mkdir -p ${XDG_CONFIG_DIR}/menus
</Menu>
EOF
-
-# Install .desktop files
-installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop
+ # Install .desktop files
+ installData ${XDG_DATA_DIR}/applications kwrite.desktop KEdit.desktop quanta.desktop kate.desktop kbabel.desktop
+}
diff --git a/menu/tests/tet_menutest b/menu/tests/tet_menutest
new file mode 100755
index 0000000..1aae67e
--- /dev/null
+++ b/menu/tests/tet_menutest
@@ -0,0 +1,39 @@
+#!/bin/bash
+TET_RUN="asdf"
+export MENUTESTDIR="${MENUTESTDIR:-/tmp/menutest}"
+. menutest
+# hack, figure out the var to use here
+
+tpstart() {
+ tet_infoline "$*"
+ FAIL=N
+}
+
+tet_startup=''
+tet_cleanup=''
+declare -i count=1
+iclist=''
+echo $TESTS
+for TESTCASE in ${TESTS}; do
+ [ ! -e "tests/${TESTCASE}/test" ] && continue;
+ # this basically curries the arg to run_test.
+ eval "tp${count}() {
+ . tests/${TESTCASE}/test
+ tpstart \"$(. tests/${TESTCASE}/test; echo ${TEST_PURPOSE-none stated})\";
+ if ! run_test tests/\"$TESTCASE\"; then
+ tet_result FAIL;
+ else
+ tet_result PASS;
+ fi
+ set +x
+ }";
+ iclist="${iclist} ic${count}"
+ eval "ic${count}=tp${count}"
+ # force subshelling, so that it doesn't pull a die on us
+ ((count+=1))
+done
+tet_iclist=iclist
+. /opt/lsb-tet3-lite/lib/posix_sh/tcm.sh
+tet_outputline 100 "xdg menu test"
+tet_tcm_main $tet_iclist
+
diff --git a/menu/tet_scen b/menu/tet_scen
new file mode 100644
index 0000000..4fe544e
--- /dev/null
+++ b/menu/tet_scen
@@ -0,0 +1,5 @@
+all
+ "Starting menu tests"
+ /tests/tet_menutest
+ "finished menu tests"
+
diff --git a/menu/tetexec.cfg b/menu/tetexec.cfg
new file mode 100644
index 0000000..ea150c9
--- /dev/null
+++ b/menu/tetexec.cfg
@@ -0,0 +1 @@
+TET_PASS_TC_NAME=True