diff --git a/Tests/NimbleTests/Matchers/BeAKindOfTest.swift b/Tests/NimbleTests/Matchers/BeAKindOfTest.swift index 2923a33e9..5628ec3b5 100644 --- a/Tests/NimbleTests/Matchers/BeAKindOfTest.swift +++ b/Tests/NimbleTests/Matchers/BeAKindOfTest.swift @@ -51,7 +51,7 @@ final class BeAKindOfObjCTest: XCTestCase { func testPositiveMatch() { expect(TestNull()).to(beAKindOf(NSNull.self)) expect(NSObject()).to(beAKindOf(NSObject.self)) - expect(NSNumber(value: 1)).toNot(beAKindOf(NSDate.self)) + expect(1 as NSNumber).toNot(beAKindOf(NSDate.self)) } func testFailureMessages() { @@ -68,10 +68,10 @@ final class BeAKindOfObjCTest: XCTestCase { let numberTypeName = "NSNumber" #endif failsWithErrorMessage("expected to be a kind of NSString, got <\(numberTypeName) instance>") { - expect(NSNumber(value: 1)).to(beAKindOf(NSString.self)) + expect(1 as NSNumber).to(beAKindOf(NSString.self)) } failsWithErrorMessage("expected to not be a kind of NSNumber, got <\(numberTypeName) instance>") { - expect(NSNumber(value: 1)).toNot(beAKindOf(NSNumber.self)) + expect(1 as NSNumber).toNot(beAKindOf(NSNumber.self)) } } } diff --git a/Tests/NimbleTests/Matchers/BeAnInstanceOfTest.swift b/Tests/NimbleTests/Matchers/BeAnInstanceOfTest.swift index 037a88766..1648fa552 100644 --- a/Tests/NimbleTests/Matchers/BeAnInstanceOfTest.swift +++ b/Tests/NimbleTests/Matchers/BeAnInstanceOfTest.swift @@ -9,7 +9,7 @@ private struct TestStructConformingToProtocol: TestProtocol {} final class BeAnInstanceOfTest: XCTestCase { func testPositiveMatch() { expect(NSNull()).to(beAnInstanceOf(NSNull.self)) - expect(NSNumber(value: 1)).toNot(beAnInstanceOf(NSDate.self)) + expect(1 as NSNumber).toNot(beAnInstanceOf(NSDate.self)) } enum TestEnum { @@ -47,10 +47,10 @@ final class BeAnInstanceOfTest: XCTestCase { let numberTypeName = "NSNumber" #endif failsWithErrorMessage("expected to be an instance of NSString, got <\(numberTypeName) instance>") { - expect(NSNumber(value: 1)).to(beAnInstanceOf(NSString.self)) + expect(1 as NSNumber).to(beAnInstanceOf(NSString.self)) } failsWithErrorMessage("expected to not be an instance of \(numberTypeName), got <\(numberTypeName) instance>") { - expect(NSNumber(value: 1)).toNot(beAnInstanceOf(type(of: NSNumber(value: 1)))) + expect(1 as NSNumber).toNot(beAnInstanceOf(type(of: 1 as NSNumber))) } } diff --git a/Tests/NimbleTests/Matchers/BeCloseToTest.swift b/Tests/NimbleTests/Matchers/BeCloseToTest.swift index 6059f48d9..bfc14c2bc 100644 --- a/Tests/NimbleTests/Matchers/BeCloseToTest.swift +++ b/Tests/NimbleTests/Matchers/BeCloseToTest.swift @@ -22,12 +22,12 @@ final class BeCloseToTest: XCTestCase { } func testBeCloseToWithNSNumber() { - expect(NSNumber(value: 1.2)).to(beCloseTo(9.300, within: 10)) - expect(NSNumber(value: 1.2)).to(beCloseTo(NSNumber(value: 9.300), within: 10)) - expect(1.2).to(beCloseTo(NSNumber(value: 9.300), within: 10)) + expect(1.2 as NSNumber).to(beCloseTo(9.300, within: 10)) + expect(1.2 as NSNumber).to(beCloseTo(9.300 as NSNumber, within: 10)) + expect(1.2).to(beCloseTo(9.300 as NSNumber, within: 10)) 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)) + expect(1.2 as NSNumber).toNot(beCloseTo(1.2001, within: 1.1)) } } diff --git a/Tests/NimbleTests/Matchers/BeEmptyTest.swift b/Tests/NimbleTests/Matchers/BeEmptyTest.swift index 3d0bddbe5..c769883c1 100644 --- a/Tests/NimbleTests/Matchers/BeEmptyTest.swift +++ b/Tests/NimbleTests/Matchers/BeEmptyTest.swift @@ -23,7 +23,7 @@ final class BeEmptyTest: XCTestCase { expect(([1] as NSArray) as? [Int]).toNot(beEmpty()) expect(NSSet()).to(beEmpty()) - expect(NSSet(array: [NSNumber(value: 1)])).toNot(beEmpty()) + expect(NSSet(array: [1 as NSNumber])).toNot(beEmpty()) expect(NSIndexSet()).to(beEmpty()) expect(NSIndexSet(index: 1)).toNot(beEmpty()) @@ -57,7 +57,7 @@ final class BeEmptyTest: XCTestCase { expect(NSSet()).toNot(beEmpty()) } failsWithErrorMessage("expected to be empty, got <{(1)}>") { - expect(NSSet(object: NSNumber(value: 1))).to(beEmpty()) + expect(NSSet(object: 1 as NSNumber)).to(beEmpty()) } failsWithErrorMessage("expected to not be empty, got <()>") { diff --git a/Tests/NimbleTests/Matchers/BeGreaterThanOrEqualToTest.swift b/Tests/NimbleTests/Matchers/BeGreaterThanOrEqualToTest.swift index b81afa579..d2cabdd09 100644 --- a/Tests/NimbleTests/Matchers/BeGreaterThanOrEqualToTest.swift +++ b/Tests/NimbleTests/Matchers/BeGreaterThanOrEqualToTest.swift @@ -7,9 +7,9 @@ final class BeGreaterThanOrEqualToTest: XCTestCase { expect(10).to(beGreaterThanOrEqualTo(10)) expect(10).to(beGreaterThanOrEqualTo(2)) expect(1).toNot(beGreaterThanOrEqualTo(2)) - expect(NSNumber(value: 1)).toNot(beGreaterThanOrEqualTo(2)) - expect(NSNumber(value: 2)).to(beGreaterThanOrEqualTo(NSNumber(value: 2))) - expect(1).to(beGreaterThanOrEqualTo(NSNumber(value: 0))) + expect(1 as NSNumber).toNot(beGreaterThanOrEqualTo(2)) + expect(2 as NSNumber).to(beGreaterThanOrEqualTo(2 as NSNumber)) + expect(1).to(beGreaterThanOrEqualTo(0 as NSNumber)) failsWithErrorMessage("expected to be greater than or equal to <2>, got <0>") { expect(0).to(beGreaterThanOrEqualTo(2)) @@ -30,8 +30,8 @@ final class BeGreaterThanOrEqualToTest: XCTestCase { func testGreaterThanOrEqualToOperator() { expect(0) >= 0 expect(1) >= 0 - expect(NSNumber(value: 1)) >= 1 - expect(NSNumber(value: 1)) >= NSNumber(value: 1) + expect(1 as NSNumber) >= 1 + expect(1 as NSNumber) >= 1 as NSNumber expect(2.5) >= 2.5 expect(2.5) >= 2 expect(Float(2.5)) >= Float(2.5) diff --git a/Tests/NimbleTests/Matchers/BeGreaterThanTest.swift b/Tests/NimbleTests/Matchers/BeGreaterThanTest.swift index 6e0df4206..7278dc85a 100644 --- a/Tests/NimbleTests/Matchers/BeGreaterThanTest.swift +++ b/Tests/NimbleTests/Matchers/BeGreaterThanTest.swift @@ -6,8 +6,8 @@ final class BeGreaterThanTest: XCTestCase { func testGreaterThan() { expect(10).to(beGreaterThan(2)) expect(1).toNot(beGreaterThan(2)) - expect(NSNumber(value: 3)).to(beGreaterThan(2 as NSNumber)) - expect(NSNumber(value: 1)).toNot(beGreaterThan(NSNumber(value: 2))) + expect(3 as NSNumber).to(beGreaterThan(2 as NSNumber)) + expect(1 as NSNumber).toNot(beGreaterThan(2 as NSNumber)) failsWithErrorMessage("expected to be greater than <2>, got <0>") { expect(0).to(beGreaterThan(2)) @@ -25,8 +25,8 @@ final class BeGreaterThanTest: XCTestCase { func testGreaterThanOperator() { expect(1) > 0 - expect(NSNumber(value: 1)) > NSNumber(value: 0) - expect(NSNumber(value: 1)) > 0 as NSNumber + expect(1 as NSNumber) > 0 as NSNumber + expect(1 as NSNumber) > 0 as NSNumber expect(2.5) > 1.5 expect(Float(2.5)) > Float(1.5) diff --git a/Tests/NimbleTests/Matchers/BeIdenticalToTest.swift b/Tests/NimbleTests/Matchers/BeIdenticalToTest.swift index e6aaa9375..54ae6f409 100644 --- a/Tests/NimbleTests/Matchers/BeIdenticalToTest.swift +++ b/Tests/NimbleTests/Matchers/BeIdenticalToTest.swift @@ -9,13 +9,13 @@ final class BeIdenticalToTest: XCTestCase { } func testBeIdenticalToNegative() { - expect(NSNumber(value: 1)).toNot(beIdenticalTo("yo" as NSString)) - expect([NSNumber(value: 1)] as NSArray).toNot(beIdenticalTo([NSNumber(value: 1)] as NSArray)) + expect(1 as NSNumber).toNot(beIdenticalTo("yo" as NSString)) + expect([1 as NSNumber] as NSArray).toNot(beIdenticalTo([1 as NSNumber] as NSArray)) } func testBeIdenticalToPositiveMessage() { - let num1 = NSNumber(value: 1) - let num2 = NSNumber(value: 2) + let num1 = 1 as NSNumber + let num2 = 2 as NSNumber let message = "expected to be identical to \(identityAsString(num2)), got \(identityAsString(num1))" failsWithErrorMessage(message) { expect(num1).to(beIdenticalTo(num2)) @@ -34,15 +34,15 @@ final class BeIdenticalToTest: XCTestCase { func testOperators() { let value = NSDate() expect(value) === value - expect(NSNumber(value: 1)) !== NSNumber(value: 2) + expect(1 as NSNumber) !== 2 as NSNumber } func testBeAlias() { let value = NSDate() expect(value).to(be(value)) - expect(NSNumber(value: 1)).toNot(be("turtles" as NSString)) + expect(1 as NSNumber).toNot(be("turtles" as NSString)) expect([1]).toNot(be([1])) - expect([NSNumber(value: 1)] as NSArray).toNot(be([NSNumber(value: 1)] as NSArray)) + expect([1 as NSNumber] as NSArray).toNot(be([1 as NSNumber] as NSArray)) let value1 = NSArray() let value2 = value1 diff --git a/Tests/NimbleTests/Matchers/BeLessThanOrEqualToTest.swift b/Tests/NimbleTests/Matchers/BeLessThanOrEqualToTest.swift index 7a543937f..78b37f445 100644 --- a/Tests/NimbleTests/Matchers/BeLessThanOrEqualToTest.swift +++ b/Tests/NimbleTests/Matchers/BeLessThanOrEqualToTest.swift @@ -8,10 +8,10 @@ final class BeLessThanOrEqualToTest: XCTestCase { expect(2).to(beLessThanOrEqualTo(10)) expect(2).toNot(beLessThanOrEqualTo(1)) - expect(NSNumber(value: 2)).to(beLessThanOrEqualTo(10)) - expect(NSNumber(value: 2)).toNot(beLessThanOrEqualTo(1)) - expect(2).to(beLessThanOrEqualTo(NSNumber(value: 10))) - expect(2).toNot(beLessThanOrEqualTo(NSNumber(value: 1))) + expect(2 as NSNumber).to(beLessThanOrEqualTo(10)) + expect(2 as NSNumber).toNot(beLessThanOrEqualTo(1)) + expect(2).to(beLessThanOrEqualTo(10 as NSNumber)) + expect(2).toNot(beLessThanOrEqualTo(1 as NSNumber)) failsWithErrorMessage("expected to be less than or equal to <0>, got <2>") { expect(2).to(beLessThanOrEqualTo(0)) diff --git a/Tests/NimbleTests/Matchers/BeLessThanTest.swift b/Tests/NimbleTests/Matchers/BeLessThanTest.swift index b17108d2a..e30238ca9 100644 --- a/Tests/NimbleTests/Matchers/BeLessThanTest.swift +++ b/Tests/NimbleTests/Matchers/BeLessThanTest.swift @@ -6,11 +6,8 @@ final class BeLessThanTest: XCTestCase { func testLessThan() { expect(2).to(beLessThan(10)) expect(2).toNot(beLessThan(1)) - expect(NSNumber(value: 2)).to(beLessThan(10 as NSNumber)) - expect(NSNumber(value: 2)).toNot(beLessThan(1 as NSNumber)) - - expect(2 as NSNumber).to(beLessThan(NSNumber(value: 10))) - expect(2 as NSNumber).toNot(beLessThan(NSNumber(value: 1))) + expect(2 as NSNumber).to(beLessThan(10 as NSNumber)) + expect(2 as NSNumber).toNot(beLessThan(1 as NSNumber)) failsWithErrorMessage("expected to be less than <0>, got <2>") { expect(2).to(beLessThan(0)) @@ -29,7 +26,7 @@ final class BeLessThanTest: XCTestCase { func testLessThanOperator() { expect(0) < 1 - expect(NSNumber(value: 0)) < 1 as NSNumber + expect(0 as NSNumber) < 1 as NSNumber failsWithErrorMessage("expected to be less than <1>, got <2>") { expect(2) < 1 return diff --git a/Tests/NimbleTests/Matchers/EqualTest.swift b/Tests/NimbleTests/Matchers/EqualTest.swift index 80b3eb33f..5dad4998c 100644 --- a/Tests/NimbleTests/Matchers/EqualTest.swift +++ b/Tests/NimbleTests/Matchers/EqualTest.swift @@ -138,10 +138,10 @@ final class EqualTest: XCTestCase { } func testNSObjectEquality() { - expect(NSNumber(value: 1)).to(equal(NSNumber(value: 1))) - expect(NSNumber(value: 1)) == NSNumber(value: 1) - expect(NSNumber(value: 1)) != NSNumber(value: 2) - expect { NSNumber(value: 1) }.to(equal(1)) + expect(1 as NSNumber).to(equal(1 as NSNumber)) + expect(1 as NSNumber) == 1 as NSNumber + expect(1 as NSNumber) != 2 as NSNumber + expect { 1 as NSNumber }.to(equal(1)) } func testOperatorEquality() { diff --git a/Tests/NimbleTests/Matchers/PostNotificationTest.swift b/Tests/NimbleTests/Matchers/PostNotificationTest.swift index 04aee5a81..ad13782f0 100644 --- a/Tests/NimbleTests/Matchers/PostNotificationTest.swift +++ b/Tests/NimbleTests/Matchers/PostNotificationTest.swift @@ -20,8 +20,8 @@ final class PostNotificationTest: XCTestCase { } func testPassesWhenAllExpectedNotificationsArePosted() { - let foo = NSNumber(value: 1) - let bar = NSNumber(value: 2) + let foo = 1 as NSNumber + let bar = 2 as NSNumber let n1 = Notification(name: Notification.Name("Foo"), object: foo) let n2 = Notification(name: Notification.Name("Bar"), object: bar) expect {