Skip to content

Commit

Permalink
Merge pull request Quick#629 from Quick/update-swift-5-snapshot
Browse files Browse the repository at this point in the history
Test Swift 5.0 (5.0-DEVELOPMENT-SNAPSHOT-2019-02-05-a)
  • Loading branch information
ikesyo authored Feb 9, 2019
2 parents dd6f46e + cc35b9e commit e581d86
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 30 deletions.
27 changes: 16 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,38 @@ matrix:
- os: osx
sudo: required
env: TYPE=podspec
install: bundle install
name: CocoaPods Lint
- os: osx
env: TYPE=ios
name: iOS / Swift 4.2.1
- os: osx
env: TYPE=tvos
name: tvOS / Swift 4.2.1
- os: osx
env: TYPE=macos
name: macOS / Swift 4.2.1
- os: osx
env:
- TYPE=swiftpm
- os: linux
- &linux
name: Linux / Swift 4.2.1
os: linux
dist: trusty
sudo: required
env:
- TYPE=swiftpm
- SWIFT_VERSION=4.2.1
install:
- eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)"
# - os: linux
# dist: trusty
# sudo: required
# env:
# - TYPE=swiftpm
# - SWIFT_VERSION=5.0-DEVELOPMENT-SNAPSHOT-2019-01-13-a
# install:
# - eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)"
install:
- if [[ "$TYPE" == "podspec" ]]; then bundle install; fi
- <<: *linux
name: Linux / Swift 5.0 Development
env:
- TYPE=swiftpm
- SWIFT_VERSION=5.0-DEVELOPMENT-SNAPSHOT-2019-02-05-a
install:
- eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)"
install: true
script:
- ./test $TYPE

Expand Down
2 changes: 1 addition & 1 deletion Sources/Nimble/Utils/Await.swift
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ internal class AwaitPromiseBuilder<T> {
self.trigger.timeoutSource.resume()
while self.promise.asyncResult.isIncomplete() {
// Stopping the run loop does not work unless we run only 1 mode
#if swift(>=4.2) && (os(macOS) || os(iOS) || os(tvOS))
#if (swift(>=4.2) && canImport(Darwin)) || compiler(>=5.0)
_ = RunLoop.current.run(mode: .default, before: .distantFuture)
#else
_ = RunLoop.current.run(mode: .defaultRunLoopMode, before: .distantFuture)
Expand Down
36 changes: 18 additions & 18 deletions Tests/NimbleTests/Matchers/BeCloseToTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider {
func testBeCloseToWithin() {
expect(1.2).to(beCloseTo(9.300, within: 10))

failsWithErrorMessage("expected to not be close to <1.2001> (within 1), got <1.2>") {
expect(1.2).toNot(beCloseTo(1.2001, within: 1.0))
failsWithErrorMessage("expected to not be close to <1.2001> (within 1.1), got <1.2>") {
expect(1.2).toNot(beCloseTo(1.2001, within: 1.1))
}
}

Expand All @@ -26,17 +26,17 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider {
expect(NSNumber(value: 1.2)).to(beCloseTo(NSNumber(value: 9.300), within: 10))
expect(1.2).to(beCloseTo(NSNumber(value: 9.300), within: 10))

failsWithErrorMessage("expected to not be close to <1.2001> (within 1), got <1.2>") {
expect(NSNumber(value: 1.2)).toNot(beCloseTo(1.2001, within: 1.0))
failsWithErrorMessage("expected to not be close to <1.2001> (within 1.1), got <1.2>") {
expect(NSNumber(value: 1.2)).toNot(beCloseTo(1.2001, within: 1.1))
}
}

func testBeCloseToWithCGFloat() {
expect(CGFloat(1.2)).to(beCloseTo(1.2001))
expect(CGFloat(1.2)).to(beCloseTo(CGFloat(1.2001)))

failsWithErrorMessage("expected to not be close to <1.2001> (within 1), got <1.2>") {
expect(CGFloat(1.2)).toNot(beCloseTo(1.2001, within: 1.0))
failsWithErrorMessage("expected to not be close to <1.2001> (within 1.1), got <1.2>") {
expect(CGFloat(1.2)).toNot(beCloseTo(1.2001, within: 1.1))
}
}

Expand Down Expand Up @@ -71,23 +71,23 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider {
expect(1.2) (9.300, 10)
expect(1.2) == (9.300, 10)

failsWithErrorMessage("expected to be close to <1> (within 0.1), got <1.2>") {
expect(1.2) (1.0, 0.1)
failsWithErrorMessage("expected to be close to <1.1> (within 0.1), got <1.3>") {
expect(1.3) (1.1, 0.1)
}
failsWithErrorMessage("expected to be close to <1> (within 0.1), got <1.2>") {
expect(1.2) == (1.0, 0.1)
failsWithErrorMessage("expected to be close to <1.1> (within 0.1), got <1.3>") {
expect(1.3) == (1.1, 0.1)
}
}

func testPlusMinusOperator() {
expect(1.2) 9.300 ± 10
expect(1.2) == 9.300 ± 10

failsWithErrorMessage("expected to be close to <1> (within 0.1), got <1.2>") {
expect(1.2) 1.0 ± 0.1
failsWithErrorMessage("expected to be close to <1.1> (within 0.1), got <1.3>") {
expect(1.3) 1.1 ± 0.1
}
failsWithErrorMessage("expected to be close to <1> (within 0.1), got <1.2>") {
expect(1.2) == 1.0 ± 0.1
failsWithErrorMessage("expected to be close to <1.1> (within 0.1), got <1.3>") {
expect(1.3) == 1.1 ± 0.1
}
}

Expand Down Expand Up @@ -132,11 +132,11 @@ final class BeCloseToTest: XCTestCase, XCTestCaseProvider {
expect([0.0, 1.1, 2.2]) [0.0001, 1.1001, 2.2001]
expect([0.0, 1.1, 2.2]).to(beCloseTo([0.1, 1.2, 2.3], within: 0.1))

failsWithErrorMessage("expected to be close to <[0, 1]> (each within 0.0001), got <[0, 1.1]>") {
expect([0.0, 1.1]) [0.0, 1.0]
failsWithErrorMessage("expected to be close to <[0.1, 1.1]> (each within 0.0001), got <[0.1, 1.2]>") {
expect([0.1, 1.2]) [0.1, 1.1]
}
failsWithErrorMessage("expected to be close to <[0.2, 1.2]> (each within 0.1), got <[0, 1.1]>") {
expect([0.0, 1.1]).to(beCloseTo([0.2, 1.2], within: 0.1))
failsWithErrorMessage("expected to be close to <[0.3, 1.3]> (each within 0.1), got <[0.1, 1.2]>") {
expect([0.1, 1.2]).to(beCloseTo([0.3, 1.3], within: 0.1))
}
}
}

0 comments on commit e581d86

Please sign in to comment.