mirror of
https://github.com/c-cube/iter.git
synced 2025-12-05 19:00:31 -05:00
test: add regression test for #38
This commit is contained in:
parent
29ece562e2
commit
df3a3de2ae
1 changed files with 16 additions and 0 deletions
|
|
@ -328,6 +328,22 @@ let () =
|
||||||
OUnit.assert_bool "not empty" (not (is_empty s));
|
OUnit.assert_bool "not empty" (not (is_empty s));
|
||||||
()
|
()
|
||||||
|
|
||||||
|
let with_tmp_file f =
|
||||||
|
let path = Filename.temp_file "test_iter" "data" in
|
||||||
|
try
|
||||||
|
let x = f path in
|
||||||
|
(try Sys.remove path with _ -> ());
|
||||||
|
x
|
||||||
|
with e ->
|
||||||
|
(try Sys.remove path with _ -> ());
|
||||||
|
raise e
|
||||||
|
|
||||||
|
let () =
|
||||||
|
with_tmp_file @@ fun path ->
|
||||||
|
Iter.IO.write_lines path Iter.empty;
|
||||||
|
let l = Iter.IO.lines_of path |> Iter.to_list in
|
||||||
|
OUnit.assert_equal ~printer:Q.Print.(list @@ Printf.sprintf "%S") [] l
|
||||||
|
|
||||||
let () =
|
let () =
|
||||||
let errcode = QCheck_base_runner.run_tests ~colors:false !qchecks in
|
let errcode = QCheck_base_runner.run_tests ~colors:false !qchecks in
|
||||||
if errcode <> 0 then exit errcode
|
if errcode <> 0 then exit errcode
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue