Configuration icon indicating copy to clipboard operation
Configuration copied to clipboard

Move TestProgram into XCT Tests

Open youming-lin opened this issue 7 years ago • 3 comments

TestProgram was written to test code that has no easy way to be tested inside XCT test cases (i.e. code that parses env var and argv). We should revisit this issue and see if there is any way to test those code in XCT without having to build a separate executable.

youming-lin avatar Mar 30 '17 21:03 youming-lin

Unable to setenv in Swift code on Linux: https://bugs.swift.org/browse/SR-5076

Moving command-line argv test to XCTest should be possible as CommandLine.arguments is a mutable array. ProcessInfo.processInfo.environment is a get-only dictionary so I'm unable to inject env var to it directly.

youming-lin avatar Jun 02 '17 19:06 youming-lin

Problem should be solved in Package.swift with the new SPM in Swift 4: https://swift.org/blog/swift-package-manager-manifest-api-redesign/

Declare all regular and test targets.

All targets and their dependencies should be explicitly declared. If there are two targets, Foo and FooTests, declare both of them in targets label.

youming-lin avatar Jun 22 '17 21:06 youming-lin

+1 on this. My applications all end up with a separate TestProgram target.

collinhundley avatar Jul 12 '17 19:07 collinhundley