Skip to content

Commit

Permalink
Remove Prop.within and Timeout outcome.
Browse files Browse the repository at this point in the history
See #397.
  • Loading branch information
kurtschelfthout committed Oct 12, 2017
1 parent 64fadd3 commit 9c2dbda
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 27 deletions.
13 changes: 0 additions & 13 deletions src/FsCheck/Prop.fs
Original file line number Diff line number Diff line change
Expand Up @@ -118,19 +118,6 @@ module Prop =
{ r with Labels = Set.add l r.Labels }) |> Future
Prop.mapResult add

///Fails the property if it does not complete within t milliseconds. Note that the called property gets a
///cancel signal, but whether it responds to that is up to the property; the execution may not actually stop.
[<EditorBrowsable(EditorBrowsableState.Never)>]
let within time (lazyProperty:Lazy<'Testable>) =
try
let test = new Func<_>(fun () -> property lazyProperty.Value)
let asyncTest = Async.FromBeginEnd(test.BeginInvoke, test.EndInvoke)
Async.RunSynchronously(asyncTest, timeout = time)
with
:? TimeoutException ->
Async.CancelDefaultToken()
property (Res.timeout time)

/// Turns a testable type into a property. Testables are unit, boolean, Lazy testables, Gen testables, functions
/// from a type for which a generator is know to a testable, tuples up to 6 tuple containing testables, and lists
/// containing testables.
Expand Down
5 changes: 0 additions & 5 deletions src/FsCheck/Runner.fs
Original file line number Diff line number Diff line change
Expand Up @@ -468,11 +468,6 @@ module Runner =
| TestResult.False (data, originalArgs, args, Outcome.Exception exc, originalSeed, lastSeed, lastSize) ->
onFailureToString name data originalArgs args originalSeed lastSeed lastSize
+ sprintf "with exception:%s%O%s" newline exc newline
| TestResult.False (data, _, args, Outcome.Timeout i, originalSeed, lastSeed, lastSize) ->
sprintf "%sTimeout of %i milliseconds exceeded, after %i test%s (%i shrink%s) (%A)%sLast step was invoked with size of %i and seed of (%A):%s"
name i data.NumberOfTests (pluralize data.NumberOfTests) data.NumberOfShrinks (pluralize data.NumberOfShrinks) originalSeed newline lastSize lastSeed newline
+ maybePrintLabels data.Labels
+ sprintf "%s%s" (args |> argumentsToString) newline
| TestResult.False (data, originalArgs, args, _, originalSeed, lastSeed, lastSize) ->
onFailureToString name data originalArgs args originalSeed lastSeed lastSize
| TestResult.Exhausted data ->
Expand Down
7 changes: 0 additions & 7 deletions src/FsCheck/Testable.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ open System

[<NoComparison; RequireQualifiedAccess>]
type Outcome =
| Timeout of int
| Exception of exn
| False
| True
Expand All @@ -26,8 +25,6 @@ type Result =
match (l.Outcome,r.Outcome) with
| (Outcome.Exception _,_) -> l //here a potential exception in r is thrown away...
| (_,Outcome.Exception _) -> r
| (Outcome.Timeout _,_) -> l
| (_,Outcome.Timeout _) -> r
| (Outcome.False,_) -> l
| (_,Outcome.False) -> r
| (_,Outcome.True) -> l
Expand All @@ -37,8 +34,6 @@ type Result =
match (l.Outcome, r.Outcome) with
| (Outcome.Exception _,_) -> r
| (_,Outcome.Exception _) -> l
| (Outcome.Timeout _,_) -> l
| (_,Outcome.Timeout _) -> r
| (_,Outcome.False) -> l
| (Outcome.False,_) -> r
| (Outcome.True,_) -> l
Expand Down Expand Up @@ -77,8 +72,6 @@ module internal Res =

let exc e = { result with Outcome = Outcome.Exception e } |> Value

let timeout i = { result with Outcome = Outcome.Timeout i } |> Value

let succeeded = { result with Outcome = Outcome.True } |> Value

let rejected = { result with Outcome = Outcome.Rejected } |> Value
Expand Down
1 change: 0 additions & 1 deletion tests/FsCheck.Test/Property.fs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ module Property =
| TestResult.Exhausted td -> td

match r0.Outcome, r1 with
| Outcome.Timeout i, TestResult.False(_,_,_,Outcome.Timeout j,_,_,_) when i = j -> r0.Labels = testData.Labels
| Outcome.Exception _, TestResult.False(_,_,_,Outcome.Exception _,_,_,_) -> r0.Labels = testData.Labels
| Outcome.False, TestResult.False(_,_,_,Outcome.False,_,_,_) -> r0.Labels = testData.Labels
| Outcome.True, TestResult.True _ -> (r0.Stamp |> Set.ofSeq) = (testData.Stamps |> Seq.map snd |> Seq.concat |> Set.ofSeq)
Expand Down
1 change: 0 additions & 1 deletion tests/FsCheck.Test/Runner.fs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ module RunnerHelper =
{ NumberOfTests = nt2; NumberOfShrinks = ns2; Stamps = sx2; Labels = lx2 } ->
nt1 = nt2 && ns1 = ns2 && Enumerable.SequenceEqual (sx1, sx2) && Enumerable.SequenceEqual (lx1, lx2)
let cmpOutcome = function
| Outcome.Timeout _, Outcome.Timeout _ -> true
| Outcome.Exception ex1, Outcome.Exception ex2 -> ex1.Equals ex2
| Outcome.False, Outcome.False -> true
| Outcome.True, Outcome.True -> true
Expand Down

0 comments on commit 9c2dbda

Please sign in to comment.