Skip to content

Commit

Permalink
Add -- test.
Browse files Browse the repository at this point in the history
  • Loading branch information
floitsch committed Mar 27, 2024
1 parent 7af3ac1 commit 3dbc577
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/dashdash_test.toit
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (C) 2024 Toitware ApS.
// Use of this source code is governed by a Zero-Clause BSD license that can
// be found in the tests/LICENSE file.
import cli
import expect show *

main:
root := cli.Command "root"
--rest=[
cli.Option "first" --required,
cli.Option "arg" --multi
]
--run=:: | _ parsed| test-dashdash parsed
root.run ["--", "prog", "arg1", "arg2", "arg3"]

test-dashdash parsed/cli.Parsed:
first := parsed["first"]
rest := parsed["arg"]
expect-equals "prog" first
expect-list-equals ["arg1", "arg2", "arg3"] rest

0 comments on commit 3dbc577

Please sign in to comment.