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
}
