fix(menubar): add tests

This commit is contained in:
Ancker-0 2022-03-29 11:49:41 +08:00
parent 24b74464b6
commit 25122ca3c3
3 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,6 @@
[Desktop Entry]
Type=Application
Name=path test
Path=/home/
Exec=ls

View File

@ -0,0 +1,7 @@
[Desktop Entry]
Type=Application
Name=terminal test
Path=/home/
Exec=ls
Terminal=true

View File

@ -145,4 +145,20 @@ describe("menubar.utils lookup_icon_uncached", function()
end)
end)
describe("menubar.utils parse_desktop_file", function()
it('check Path field', function()
local root = (os.getenv("SOURCE_DIRECTORY") or '.') .. "/spec/menubar"
local program = utils.parse_desktop_file(root .. '/usr/share/applications/path.desktop')
assert.are.equal(program.cmdline, 'cd /home/ && ls')
assert.is_true(program.with_shell)
end)
it('check Terminal field', function()
local root = (os.getenv("SOURCE_DIRECTORY") or '.') .. "/spec/menubar"
local program = utils.parse_desktop_file(root .. '/usr/share/applications/term.desktop')
assert.are.equal(program.cmdline, 'cd /home/ && ' .. utils.terminal .. ' -e ls')
assert.is_true(program.with_shell)
end)
end)
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80