Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move TestProgram into XCT Tests #23

Open
youming-lin opened this issue Mar 30, 2017 · 3 comments
Open

Move TestProgram into XCT Tests #23

youming-lin opened this issue Mar 30, 2017 · 3 comments

Comments

@youming-lin
Copy link
Collaborator

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
Copy link
Collaborator Author

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
Copy link
Collaborator Author

youming-lin commented Jun 22, 2017

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.

@collinhundley
Copy link

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

@youming-lin youming-lin mentioned this issue Sep 11, 2017
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants