Skip to content

Commit

Permalink
Add a linking and type equality tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dra27 committed Jun 21, 2022
1 parent 3d0372a commit 8aaedd8
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
_build
camlpstreams.opam
*~
dune-workspace
16 changes: 16 additions & 0 deletions dune-workspace.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
(lang dune 1.0)
(context default)
; Test on all 4.x versions as well
(context (opam (switch 4.02)))
(context (opam (switch 4.03)))
(context (opam (switch 4.04)))
(context (opam (switch 4.05)))
(context (opam (switch 4.06)))
(context (opam (switch 4.07)))
(context (opam (switch 4.08)))
(context (opam (switch 4.09)))
(context (opam (switch 4.10)))
(context (opam (switch 4.11)))
(context (opam (switch 4.12)))
(context (opam (switch 4.13)))
(context (opam (switch 4.14)))
41 changes: 41 additions & 0 deletions test/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
(library
(name stream_stdlib)
(flags :standard -w -3)
(modules stream_stdlib)
(enabled_if (< %{ocaml_version} 5.0)))

(library
(name stream_camlp_streams)
(libraries camlp-streams)
(modules stream_camlp_streams))

(executable
(name equality)
(libraries stream_stdlib stream_camlp_streams)
(modules equality)
(enabled_if (< %{ocaml_version} 5.0)))

(rule
(action (with-stdout-to equality.output (run ./equality.exe)))
(enabled_if (< %{ocaml_version} 5.0)))

(rule
(alias runtest)
(action (diff equality.expected equality.output))
(enabled_if (< %{ocaml_version} 5.0)))

(executable
(name linking)
(libraries camlp-streams stream_stdlib)
(modules linking)
(flags :standard -w -3)
(enabled_if (< %{ocaml_version} 5.0)))

(rule
(action (with-stdout-to issue4.output (run ./linking.exe)))
(enabled_if (< %{ocaml_version} 5.0)))

(rule
(alias runtest)
(action (diff issue4.expected issue4.output))
(enabled_if (< %{ocaml_version} 5.0)))
6 changes: 6 additions & 0 deletions test/equality.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
(* Test type equality between a library using camlp-streams and one using
Stdlib.Stream *)

let () =
Stream.empty Stream_stdlib.stream;
Stream.empty Stream_camlp_streams.stream
6 changes: 6 additions & 0 deletions test/linking.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
(* Test that we can link programs using libraries which use Stream.t but don't
necessarily use camlp-streams. Test is most relevant on 4.02-4.06 before the
Stdlib module was introduced. *)

let () =
Stream.(empty (Stream.of_list Stream_stdlib.list))
1 change: 1 addition & 0 deletions test/stream_camlp_streams.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
let stream = Stream.of_list ([] : unit list)
2 changes: 2 additions & 0 deletions test/stream_stdlib.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
let list = ([] : unit list)
let stream = Stream.of_list list

0 comments on commit 8aaedd8

Please sign in to comment.