Skip to content

Commit

Permalink
Remove stdio from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MisterDA committed Jan 8, 2022
1 parent 405d2a6 commit 8d27064
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
1 change: 0 additions & 1 deletion dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@
ctypes
ctypes-foreign
(ounit2 :with-test)
(stdio :with-test)
))
1 change: 0 additions & 1 deletion gobject-introspection.opam
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ depends: [
"ctypes"
"ctypes-foreign"
"ounit2" {with-test}
"stdio" {with-test}
"odoc" {with-doc}
]
build: [
Expand Down
14 changes: 11 additions & 3 deletions tests/Test_version.ml
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
open Test_utils
open OUnit2
open GObject_introspection
open Stdio

let input_lines ch =
let rec aux acc =
match input_line ch with
| exception End_of_file -> List.rev acc
| line -> aux (line :: acc)
in
aux []

let test_get_version _ =
let major = Version.get_major_version () |> string_of_int in
Expand All @@ -10,8 +17,9 @@ let test_get_version _ =
let version = String.concat "." [ major; minor; micro ] in
let run cmd =
let inp = Unix.open_process_in cmd in
let r = In_channel.input_lines inp in
In_channel.close inp;
let r =
Fun.protect (fun () -> input_lines inp) ~finally:(fun () -> close_in inp)
in
List.hd r
in
let modversion =
Expand Down

0 comments on commit 8d27064

Please sign in to comment.