Skip to content

Commit

Permalink
avoid misuse of Launcher.Set
Browse files Browse the repository at this point in the history
  • Loading branch information
ysmood committed Jun 27, 2022
1 parent 908739c commit 3ce5edd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/launcher/launcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ func (l *Launcher) Context(ctx context.Context) *Launcher {

// Set a command line argument to launch the browser.
func (l *Launcher) Set(name flags.Flag, values ...string) *Launcher {
if strings.Contains(string(name), "=") {
panic("flag name should not contain '='")
}
l.Flags[l.normalizeFlag(name)] = values
return l
}
Expand Down
4 changes: 4 additions & 0 deletions lib/launcher/launcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ func TestLaunch(t *testing.T) {
_, err = launcher.NewManaged("ws://not-exists")
g.Err(err)
}

{
g.Panic(func() { launcher.New().Set("a=b") })
}
}

func TestLaunchUserMode(t *testing.T) {
Expand Down

0 comments on commit 3ce5edd

Please sign in to comment.