Skip to content

TestNSNumber: Disable testNSNumberToBool() that breaks on Darwin. #2030

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 23, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions TestFoundation/TestNSNumberBridging.swift
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,11 @@ class TestNSNumberBridging : XCTestCase {
}

func testNSNumberToBool() {
// FIXME: When running swift-corelibs-foundation on Darwin, these tests all give the warning:
// 'Conditional cast from 'NSNumber' to 'Bool' always succeeds' and never return nil so these tests fail.
// These tests work on Darwin using normal Foundation (when testing with DarwinCompatibilityTests)
// and also work on Linux, so just disable them on Darwin/swift-corelibs-foundation.
#if !canImport(SwiftFoundation)
let b0 = NSNumber(value: 0) as? Bool
XCTAssertNotNil(b0)
XCTAssertEqual(b0, false)
Expand Down Expand Up @@ -664,6 +669,7 @@ class TestNSNumberBridging : XCTestCase {
XCTAssertNil(NSNumber(value: Int64.max) as? Bool)
XCTAssertNil(NSNumber(value: Int.min) as? Bool)
XCTAssertNil(NSNumber(value: Int.max) as? Bool)
#endif
}
}

Expand Down