Persimmon icon indicating copy to clipboard operation
Persimmon copied to clipboard

trapに例外で失敗するTestCaseを渡したい

Open hafuu opened this issue 7 years ago • 0 comments

let createTest expected xs = test {
  let actual = xs |> Seq.find (fun x -> x = expected)
  do! actual |> assertEquals expected
}

let ok = createTest 1 [ 1; 2 ]
let ng = test {
  let! ex = trap { it (createTest 0 [ 1; 2 ]) } // Expect thrown exn but not
  do! ...
}

trapは関数を受け取るため、テストケースを渡しても例外を補足してくれません。

hafuu avatar Dec 25 '17 08:12 hafuu