<div dir="ltr">Greetings,<div><br></div><div>I am close to getting XCTests running in the swift repl, but for some reason my tests are never invoked. Does anyone have a suggestion or see something wrong with the test setup?</div><div><br></div><div>$ xcrun swift -F /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks</div>
<div><pre style="font-family:Consolas,"DejaVu Sans Mono","Bitstream Vera Sans Mono",monospace;font-size:13px;letter-spacing:0.015em;line-height:15.6px;padding:0.5em;border:1px solid rgb(204,204,204);border-radius:2px;background:rgb(240,240,240)"><span class="" style="color:rgb(0,112,32);font-weight:bold">import</span><font color="#000000"> </font><span class="" style="color:rgb(14,132,181);font-weight:bold">Foundation</span><font color="#000000">
</font><span class="" style="color:rgb(96,160,176);font-style:italic">// If you're copy pasting, copy paste these individually!</span><font color="#000000">
</font><span class="" style="color:rgb(96,160,176);font-style:italic">// If you get a null pointer back, use perror(dlerror()) to get a description of the error</span><font color="#000000">
</font><span class="" style="color:rgb(14,132,181);font-weight:bold">dlopen</span><span class="" style="color:rgb(0,0,0)">(</span><span class="" style="color:rgb(64,112,160)">"/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks/XCTest.framework/Versions/A/XCTest"</span><span class="" style="color:rgb(0,0,0)">,</span><font color="#000000"> </font><span class="" style="color:rgb(14,132,181);font-weight:bold">RTLD_NOW</span><span class="" style="color:rgb(0,0,0)">)</span><font color="#000000">
</font><span class="" style="color:rgb(0,0,0)">dlopen</span><span class="" style="color:rgb(0,0,0)">(</span><span class="" style="color:rgb(64,112,160)">"/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/libswiftXCTest.dylib"</span><span class="" style="color:rgb(0,0,0)">,</span><font color="#000000"> </font><span class="" style="color:rgb(0,0,0)">RTLD_NOW</span><span class="" style="color:rgb(0,0,0)">)</span><font color="#000000">
</font><span class="" style="color:rgb(0,112,32);font-weight:bold">import</span><font color="#000000"> </font><span class="" style="color:rgb(14,132,181);font-weight:bold">XCTest</span><font color="#000000">
</font><span class="" style="color:rgb(0,112,32);font-weight:bold">class</span><font color="#000000"> </font><span class="" style="color:rgb(14,132,181);font-weight:bold">MyTest</span><font color="#000000"> </font><span class="" style="color:rgb(0,0,0)">:</span><font color="#000000"> </font><span class="" style="color:rgb(0,0,0)">XCTestCase</span><font color="#000000"> </font><span class="" style="color:rgb(0,0,0)">{</span><font color="#000000">
</font><span class="" style="color:rgb(0,112,32);font-weight:bold">override</span><font color="#000000"> </font><span class="" style="color:rgb(0,112,32);font-weight:bold">func</span><font color="#000000"> </font><span class="" style="color:rgb(6,40,126)">setUp</span><span class="" style="color:rgb(0,0,0)">()</span><font color="#000000"> </font><span class="" style="color:rgb(0,0,0)">{</span><font color="#000000">
</font><span class="" style="color:rgb(0,112,32);font-weight:bold">super</span><span class="" style="color:rgb(0,0,0)">.</span><span class="" style="color:rgb(0,0,0)">setUp</span><span class="" style="color:rgb(0,0,0)">()</span><font color="#000000">
</font><span class="" style="color:rgb(0,112,32)">print</span><span class="" style="color:rgb(0,0,0)">(</span><span class="" style="color:rgb(64,112,160)">"Setting up"</span><span class="" style="color:rgb(0,0,0)">)</span><font color="#000000">
</font><span class="" style="color:rgb(0,0,0)">}</span><font color="#000000">
</font><span class=""><font color="#000000"> </font></span><span class="" style="color:rgb(0,112,32);font-weight:bold">override</span><font color="#000000"> </font><span class="" style="color:rgb(0,112,32);font-weight:bold">func</span><font color="#000000"> </font><span class="" style="color:rgb(6,40,126)">tearDown</span><span class="" style="color:rgb(0,0,0)">()</span><font color="#000000"> </font><span class="" style="color:rgb(0,0,0)">{</span><font color="#000000">
</font><span class="" style="color:rgb(0,112,32);font-weight:bold">super</span><span class="" style="color:rgb(0,0,0)">.</span><span class="" style="color:rgb(0,0,0)">tearDown</span><span class="" style="color:rgb(0,0,0)">()</span><font color="#000000">
</font><span class=""><font color="#000000"> </font></span><span class="" style="color:rgb(0,112,32)">print</span><span class="" style="color:rgb(0,0,0)">(</span><span class="" style="color:rgb(64,112,160)">"Tearing down"</span><span class="" style="color:rgb(0,0,0)">)</span><font color="#000000">
</font><span class="" style="color:rgb(0,0,0)">}</span><font color="#000000">
</font><span class="" style="color:rgb(0,112,32);font-weight:bold">func</span><font color="#000000"> </font><span class="" style="color:rgb(6,40,126)">testIt</span><span class="" style="color:rgb(0,0,0)">()</span><font color="#000000"> </font><span class="" style="color:rgb(0,0,0)">{</span><font color="#000000">
</font><span class="" style="color:rgb(0,112,32)">print</span><span class="" style="color:rgb(0,0,0)">(</span><span class="" style="color:rgb(64,112,160)">"I'm never here"</span><span class="" style="color:rgb(0,0,0)">)</span><font color="#000000">
</font><span class="" style="color:rgb(0,0,0)">XCTAssertTrue</span><span class="" style="color:rgb(0,0,0)">(</span><span class="" style="color:rgb(0,112,32);font-weight:bold">false</span><span class="" style="color:rgb(0,0,0)">,</span><font color="#000000"> </font><span class="" style="color:rgb(64,112,160)">"I never see this!"</span><span class="" style="color:rgb(0,0,0)">)</span><font color="#000000">
</font><span class="" style="color:rgb(0,0,0)">}</span><font color="#000000">
</font><span class="" style="color:rgb(0,0,0)">}</span><font color="#000000">
</font><span class="" style="color:rgb(0,112,32);font-weight:bold">let</span><font color="#000000"> </font><span class="" style="color:rgb(187,96,213)">suite</span><font color="#000000"> </font><span class="" style="color:rgb(0,0,0)">=</span><font color="#000000"> </font><span class="" style="color:rgb(0,0,0)">XCTestSuite</span><span class="" style="color:rgb(0,0,0)">(</span><span class="" style="color:rgb(0,0,0)">name</span><span class="" style="color:rgb(0,0,0)">:</span><font color="#000000"> </font><span class="" style="color:rgb(64,112,160)">"foo"</span><span class="" style="color:rgb(0,0,0)">)</span><font color="#000000">
</font><span class="" style="color:rgb(0,0,0)">suite</span><span class="" style="color:rgb(0,0,0)">.</span><span class="" style="color:rgb(0,0,0)">addTest</span><span class="" style="color:rgb(0,0,0)">(</span><span class="" style="color:rgb(0,0,0)">MyTest</span><span class="" style="color:rgb(0,0,0)">())</span><font color="#000000">
</font><span class="" style="color:rgb(0,0,0)">suite</span><span class="" style="color:rgb(0,0,0)">.</span><span class="" style="color:rgb(0,0,0)">run</span><span class="" style="color:rgb(0,0,0)">()</span></pre></div><div>I see the "setting up" and "tearing down" output, but I never see the print inside -testIt. Any ideas?</div><div><br></div><div>Thanks, </div><div>Lou</div><div><br></div></div>