func (s *sanitizeDesktopFileSuite) TestRewriteExecLineOk(c *C) { snap, err := snap.InfoFromSnapYaml([]byte(` name: snap version: 1.0 apps: app: command: cmd `)) c.Assert(err, IsNil) newl, err := wrappers.RewriteExecLine(snap, "foo.desktop", "Exec=snap.app") c.Assert(err, IsNil) c.Assert(newl, Equals, fmt.Sprintf("Exec=env BAMF_DESKTOP_FILE_HINT=foo.desktop %s/bin/snap.app", dirs.SnapMountDir)) }
func (s *sanitizeDesktopFileSuite) TestRewriteExecLineInvalid(c *C) { snap := &snap.Info{} _, err := wrappers.RewriteExecLine(snap, "foo.desktop", "Exec=invalid") c.Assert(err, ErrorMatches, `invalid exec command: "invalid"`) }