私はKituraとXcodeが新しく、テストファイルを追加する際にいくつかの問題に直面しています。 @testingディレクティブに関連しているようです。 Kitura websiteに示されているのと同じ設定があります。 私は、迅速なテストコンソールに迅速ビルドを呼び出すと、私は次のエラーを取得する:Kituraで単体テストを実行するとエラーが発生する
Compile Swift Module 'testTests' (1 sources)
Linking ./.build/debug/testPackageTests.xctest/Contents/MacOS/testPackageTests
Undefined symbols for architecture x86_64:
"__TFC4test3OkoCfT_S0_", referenced from:
__TFC9testTests8OkoTests8test_addfT_T_ in OkoTests.swift.o
"__TMaC4test3Oko", referenced from:
__TFC9testTests8OkoTests8test_addfT_T_ in OkoTests.swift.o
ld: symbol(s) not found for architecture x86_64
<unknown>:0: error: link command failed with exit code 1 (use -v to see invocation)
<unknown>:0: error: build had 1 command failures
error: exit(1): /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-build-tool -f /Users/*user*/Projects/Kitura/test/.build/debug.yaml test
私はライン@testableインポートテストをコメントアウトして、迅速なテストを迅速なビルドを入力ししかし、とき次にエラーが発生します:
Compile Swift Module 'testTests' (1 sources)
/Users/*user*/Projects/Kitura/test/Tests/testTests/OkoTests.swift:6:17: error: use of unresolved identifier 'Oko'
let o = Oko()
^~~
<unknown>:0: warning: 'cacheParamsComputed' is deprecated
<unknown>:0: warning: 'cacheAlphaComputed' is deprecated
<unknown>:0: warning: 'keepCacheWindow' is deprecated
<unknown>:0: error: 'memoryless' is unavailable
Metal.MTLCommandBufferError:19:14: note: 'memoryless' has been explicitly marked unavailable here
case memoryless
^
<unknown>:0: error: build had 1 command failures
error: exit(1): /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-build-tool -f /Users/*user*/Projects/Kitura/test/.build/debug.yaml test
Xcodeからテストしようとするとテストファイルなし
は、すべてが正常に動作します。代わりにneratedプロジェクト(迅速パッケージ生成-xcodeproj)が、私はエラーをコンパイルし得ます。私は問題はスウィフトはmain.swift
ファイルが含まれているモジュール(すなわち、として実行ファイルにコンパイルされることを意図されているモジュールのユニットテストをコンパイルすることはできないということであると信じてい
あなたのプロジェクトを共有できますか? GitHubリポジトリへのリンクで十分です。 最初のエラーから、私の推測では、フォルダの名前が正しくない(testPackageTestsとは何ですか?) –
@YoumingLin:ここには[link](https://github.com/kkris1983/first.git)です – kkris1983