passing command line arguments to `swift test`

Is there a way I can pass command line arguments along to the testing
program with `swift test` so that they are visible in
`CommandLine.arguments`?

i want to be able to run a single test case at a time instead of my whole test suite and i’m currently invoking the test binary directly after doing `swift test`

···

On May 19, 2017, at 4:56 PM, Brent Royal-Gordon <brent@architechies.com> wrote:

On May 18, 2017, at 8:16 AM, Kelvin Ma via swift-users <swift-users@swift.org> wrote:

Is there a way I can pass command line arguments along to the testing program with `swift test` so that they are visible in `CommandLine.arguments`?

No. If there were one, you would not be able to reliably invoke the tests automatically.

What are you trying to do? Test code that uses `CommandLine.arguments`?

--
Brent Royal-Gordon
Architechies

To run one test you can use:
  swift test -s BasicTests.PathTests/testContains

See:
  swift test --help

- Daniel

···

On May 19, 2017, at 4:34 PM, Kelvin Ma via swift-users <swift-users@swift.org> wrote:

i want to be able to run a single test case at a time instead of my whole test suite and i’m currently invoking the test binary directly after doing `swift test`

On May 19, 2017, at 4:56 PM, Brent Royal-Gordon <brent@architechies.com> wrote:

On May 18, 2017, at 8:16 AM, Kelvin Ma via swift-users <swift-users@swift.org> wrote:

Is there a way I can pass command line arguments along to the testing program with `swift test` so that they are visible in `CommandLine.arguments`?

No. If there were one, you would not be able to reliably invoke the tests automatically.

What are you trying to do? Test code that uses `CommandLine.arguments`?

--
Brent Royal-Gordon
Architechies

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

For reference, because swift test --help is long, the new syntax is:

# Struct.method
 swift test --filter PathTests.testContains
# or keyword
 swift test --filter contains
# or thing to leave out...
swift test --skip timeWaster

Great improvement!

1 Like