Swift Test传递参数

Swift Test传递参数,第1张

概述有谁知道如何为 swift测试提供命令行参数? 我试过了 : 快速测试“myDBName” 但我得到了意外的争论错误. 可能的参数列表是: OVERVIEW: Build and run testsUSAGE: swift test [options]OPTIONS: --build-path Specify build/cache directory [defa 有谁知道如何为 swift测试提供命令行参数?

我试过了 :
快速测试“myDBname”

但我得到了意外的争论错误.

可能的参数列表是:

OVERVIEW: Build and run testsUSAGE: swift test [options]OPTIONS:  --build-path            Specify build/cache directory [default: ./.build]  --chdir,-C             Change working directory before any other operation  --color                 Specify color mode (auto|always|never) [default: auto]  --configuration,-c     Build with configuration (deBUG|release) [default: deBUG]  --enable-prefetching    Enable prefetching in resolver  --List-tests,-l        Lists test methods in specifIEr format  --parallel              Run the tests in parallel.  --skip-build            Skip building the test target  --specifIEr,-s         Run a specific test class or method,Format: <test-module>.<test-case> or <test-module>.<test-case>/<test>  --verbose,-v           Increase verbosity of informational output  -Xcc                    Pass flag through to all C compiler invocations  -Xlinker                Pass flag through to all linker invocations  -Xswiftc                Pass flag through to all Swift compiler invocations  --help                  display available options

有没有其他方法来传递args? (环境变量等?)

实际上,您可以使用环境来完成它.

具有以下内容的测试:

final class HelloTests: XCTestCase {    func testExample() {        XCTAssertEqual(String(cString: getenv("SOMETHING")),"else")    }    static var allTests = [        ("testExample",testExample),]}

使用swift命令行将成功:

SOMETHING=else swift test
总结

以上是内存溢出为你收集整理的Swift Test传递参数全部内容,希望文章能够帮你解决Swift Test传递参数所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://www.outofmemory.cn/web/1034417.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-24
下一篇 2022-05-24

发表评论

登录后才能评论

评论列表(0条)

保存