iabudiab / HTMLKit

An Objective-C framework for your everyday HTML needs.
MIT License
239 stars 27 forks source link

Fix tests for Swift 3.1 #7

Closed tali closed 7 years ago

iabudiab commented 7 years ago

@tali Could you please merge against develop instead of master

iabudiab commented 7 years ago

Swift 3.1 tests are on my agenda for the coming weekend. Especially running the runtime tests, i.e. the Tokenizer and Tree Construction tests. These run fine when started in Xcode or via xcodebuild but are not detected using pure swift test.

The next thing that is bugging me is the umbrella and all the private headers. I have yet to find a clean solution to prevent all the incomplete umbrella warnings.

I'll be in touch tomorrow, since it is already 1:30 AM over here :)

tali commented 7 years ago

I didn't notice it at first, but the test suite is still failing when run in Swift 3.1:

Test Suite 'HTMLKitTokenizerPerformance' started at 2017-03-07 07:42:19.953
Test Case '-[HTMLKitTokenizerPerformance testTokenizerPerformance]' started.
2017-03-07 07:42:20.207 xctest[22261:6347726] NSScanner: nil string argument
zsh: exit 1     swift test

The call to [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil] tries to read from .../Contents/Resources/Fixtures/HTML Standard.html and returns nil.

iabudiab commented 7 years ago

@tali Hey there, I have taken a look at the whole testing thing with SwiftPM. The resources couldn't be loaded with SwiftPM because they are not copied into the testing bundle. In Xcode there is the "Copy Bundle Resources" phase that takes care of things.

I have introduced a small helper function to load the fixtures that should behave correctly for Xcode and SwiftPM testing. You can find it on develop.

Could you please make the PR against develop instead of master so I can merge it.

tali commented 7 years ago

Done, I created #8 for that.