Can I run Swift test windows from the command line without an Xcode project?

I made several extensions for the Array and String class in the files Array.swift and String.swift; I also added a unit test for them in ArrayTest.swift and StringTest.swift respectively. Now I would like to run these unit tests from the command line without the Xcode project file .

After reading How to run XCTest for a quick application from the command line? I came up with something like this:

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 

... which seems to compile the array extensions into a module. But how can I compile / link the file ArrayTest.swift with this module?

+5
source share

Source: https://habr.com/ru/post/1207590/


All Articles