Skip to content

Commit 04caaaa

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents d182b48 + 76a8c8a commit 04caaaa

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

Diff for: SwiftCheck/Operators.swift

+10-2
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,21 @@ infix operator ==> {
1313

1414
/// Models implication for properties. That is, the property holds if the first argument is false
1515
/// (in which case the test case is discarded), or if the given property holds.
16-
public func ==>(b : Bool, p : Testable) -> Property {
16+
public func ==>(b : Bool, @autoclosure p : () -> Testable) -> Property {
1717
if b {
18-
return p.property()
18+
return p().property()
1919
}
2020
return Discard().property()
2121
}
2222

23+
/// Models implication for properties. That is, the property holds if the first argument is false
24+
/// (in which case the test case is discarded), or if the given property holds.
25+
public func ==>(b : Bool, p : () -> Testable) -> Property {
26+
if b {
27+
return p().property()
28+
}
29+
return Discard().property()
30+
}
2331

2432
infix operator ==== {
2533
precedence 140

Diff for: SwiftCheckTests/ShrinkSpec.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class ShrinkSpec : XCTestCase {
3535
return (!l.getArray.isEmpty && l.getArray != [0]) ==> {
3636
let ls = self.shrinkArbitrary(l).map { $0.getArray }
3737
return (ls.filter({ $0 == [] || $0 == [0] }).count >= 1)
38-
}()
38+
}
3939
}
4040

4141
// This should not hold because eventually you'll get to [0, 0] which gets shrunk from
@@ -44,7 +44,7 @@ class ShrinkSpec : XCTestCase {
4444
return (!s.getSet.isEmpty && s.getSet != Set([0])) ==> {
4545
let ls = self.shrinkArbitrary(s).map { $0.getSet }
4646
return (ls.filter({ $0 == [] || $0 == [0] }).count >= 1)
47-
}()
47+
}
4848
})
4949
}
5050
}

0 commit comments

Comments
 (0)