是否可以在没有Xcode项目的情况下从命令行运行Swift测试用例?
我对Array.swift和String.swift文件中的Array&String类做了一些扩展;我还分别在ArrayTest.swift和StringTest.swift中为它们添加了单元测试。现在我想从命令行运行这些单元测试,而不需要Xcode项目文件 在阅读之后,我想到了这样的想法:是否可以在没有Xcode项目的情况下从命令行运行Swift测试用例?,xcode,swift,command-line,Xcode,Swift,Command Line,我对Array.swift和String.swift文件中的Array&String类做了一些扩展;我还分别在ArrayTest.swift和StringTest.swift中为它们添加了单元测试。现在我想从命令行运行这些单元测试,而不需要Xcode项目文件 在阅读之后,我想到了这样的想法: xcrun -sdk macosx swiftc -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Develop
xcrun -sdk macosx swiftc -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks \
-Xlinker -rpath \
-Xlinker /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks \
-lswiftCore Array.swift \
-module-name array_extension
。。。这似乎是在将数组扩展编译成一个模块。但是,如何针对此模块编译/链接
ArrayTest.swift
文件?检查此项-设置一个包,包括一个测试目标,然后您可以运行swift测试