Skip to content

Commit

Permalink
desktop/desktopentry: add a test for the "is not an absolute URI" case
Browse files Browse the repository at this point in the history
  • Loading branch information
jhenstridge authored and mvo5 committed Sep 6, 2023
1 parent 9760176 commit dfece4e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion desktop/desktopentry/expand_exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func toFilePath(uri string) (string, error) {
return "", err
}
if !u.IsAbs() {
return "", fmt.Errorf("%q is not absolute", uri)
return "", fmt.Errorf("%q is not an absolute URI", uri)
}
if u.Scheme != "file" {
return "", fmt.Errorf("%q is not a file URI", uri)
Expand Down
8 changes: 8 additions & 0 deletions desktop/desktopentry/expand_exec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,14 @@ func (s *desktopentrySuite) TestExpandExecHelper(c *C) {
}, {
in: `foo "unclosed double quote`,
err: "EOF found when expecting closing quote",
}, {
in: `foo %f`,
uris: []string{"/foo"},
err: `"/foo" is not an absolute URI`,
}, {
in: `foo %f`,
uris: []string{"foo/bar"},
err: `"foo/bar" is not an absolute URI`,
}} {
c.Logf("tc %d", i)

Expand Down

0 comments on commit dfece4e

Please sign in to comment.