Skip to content

Commit 8bfbeb5

Browse files
committed
Remove stdio from tests
1 parent 405d2a6 commit 8bfbeb5

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

dune-project

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,4 @@
2121
ctypes
2222
ctypes-foreign
2323
(ounit2 :with-test)
24-
(stdio :with-test)
2524
))

gobject-introspection.opam

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ depends: [
2222
"ctypes"
2323
"ctypes-foreign"
2424
"ounit2" {with-test}
25-
"stdio" {with-test}
2625
"odoc" {with-doc}
2726
]
2827
build: [

tests/Test_version.ml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
open Test_utils
22
open OUnit2
33
open GObject_introspection
4-
open Stdio
4+
5+
let input_lines ch =
6+
let rec aux acc =
7+
match input_line ch with
8+
| exception End_of_file -> List.rev acc
9+
| line -> aux (line :: acc)
10+
in
11+
aux []
512

613
let test_get_version _ =
714
let major = Version.get_major_version () |> string_of_int in
@@ -10,8 +17,7 @@ let test_get_version _ =
1017
let version = String.concat "." [ major; minor; micro ] in
1118
let run cmd =
1219
let inp = Unix.open_process_in cmd in
13-
let r = In_channel.input_lines inp in
14-
In_channel.close inp;
20+
let r = Fun.protect (fun () -> input_lines inp) ~finally:(fun () -> close_in inp) in
1521
List.hd r
1622
in
1723
let modversion =

0 commit comments

Comments
 (0)