summaryrefslogtreecommitdiff
path: root/testsuite/tests/basic-modules
diff options
context:
space:
mode:
authorThomas Refis <thomas.refis@gmail.com>2019-09-02 11:43:26 +0100
committerThomas Refis <thomas.refis@gmail.com>2019-09-11 13:44:31 -0400
commit6f492fdbd9c352c0502c118a80d451b8867b1dae (patch)
tree7957c84f5a7425a87a8aaa99f261f18750daec3f /testsuite/tests/basic-modules
parentf814450b605852429613e4ae7f68bac0382e3f1d (diff)
downloadocaml-pr8908.tar.gz
PR#8908: used as a base for other PRs.pr8908
Diffstat (limited to 'testsuite/tests/basic-modules')
-rw-r--r--testsuite/tests/basic-modules/anonymous.ml43
-rw-r--r--testsuite/tests/basic-modules/anonymous.ocamlc.reference16
-rw-r--r--testsuite/tests/basic-modules/anonymous.ocamlopt.flambda.reference15
-rw-r--r--testsuite/tests/basic-modules/anonymous.ocamlopt.reference17
-rw-r--r--testsuite/tests/basic-modules/ocamltests1
5 files changed, 92 insertions, 0 deletions
diff --git a/testsuite/tests/basic-modules/anonymous.ml b/testsuite/tests/basic-modules/anonymous.ml
new file mode 100644
index 0000000000..dd8546c32f
--- /dev/null
+++ b/testsuite/tests/basic-modules/anonymous.ml
@@ -0,0 +1,43 @@
+(* TEST
+flags = "-c -nostdlib -nopervasives -dlambda -dno-unique-ids"
+* setup-ocamlc.byte-build-env
+** ocamlc.byte
+*** check-ocamlc.byte-output
+compiler_reference = "${test_source_directory}/anonymous.ocamlc.reference"
+
+* setup-ocamlopt.byte-build-env
+** ocamlopt.byte
+*** no-flambda
+**** check-ocamlopt.byte-output
+compiler_reference = "${test_source_directory}/anonymous.ocamlopt.reference"
+*** flambda
+**** check-ocamlc.byte-output
+compiler_reference =
+ "${test_source_directory}/anonymous.ocamlopt.flambda.reference"
+*)
+
+module _ = struct
+ let x = 13, 37
+end
+
+module rec A : sig
+ type t = B.t
+end = A
+and _ : sig
+ type t = A.t
+ val x : int * int
+end = struct
+ type t = B.t
+ let x = 4, 2
+end
+and B : sig
+ type t
+end = struct
+ type t
+
+ let x = "foo", "bar"
+end
+
+module type S
+
+let f (module _ : S) = ()
diff --git a/testsuite/tests/basic-modules/anonymous.ocamlc.reference b/testsuite/tests/basic-modules/anonymous.ocamlc.reference
new file mode 100644
index 0000000000..f048af85a2
--- /dev/null
+++ b/testsuite/tests/basic-modules/anonymous.ocamlc.reference
@@ -0,0 +1,16 @@
+(setglobal Anonymous!
+ (seq (ignore (let (x = [0: 13 37]) (makeblock 0 x)))
+ (let
+ (A =
+ (apply (field 0 (global CamlinternalMod!)) [0: "anonymous.ml" 25 6]
+ [0: [0]])
+ B =
+ (apply (field 0 (global CamlinternalMod!)) [0: "anonymous.ml" 35 6]
+ [0: [0]]))
+ (seq (ignore (let (x = [0: 4 2]) (makeblock 0 x)))
+ (apply (field 1 (global CamlinternalMod!)) [0: [0]] A
+ (module-defn(A) anonymous.ml(23):567-608 A))
+ (apply (field 1 (global CamlinternalMod!)) [0: [0]] B
+ (module-defn(B) anonymous.ml(33):703-773
+ (let (x = [0: "foo" "bar"]) (makeblock 0))))
+ (let (f = (function param 0a)) (makeblock 0 A B f))))))
diff --git a/testsuite/tests/basic-modules/anonymous.ocamlopt.flambda.reference b/testsuite/tests/basic-modules/anonymous.ocamlopt.flambda.reference
new file mode 100644
index 0000000000..2d5daff479
--- /dev/null
+++ b/testsuite/tests/basic-modules/anonymous.ocamlopt.flambda.reference
@@ -0,0 +1,15 @@
+(seq (ignore (let (x = [0: 13 37]) (makeblock 0 x)))
+ (let
+ (A =
+ (apply (field 0 (global CamlinternalMod!)) [0: "anonymous.ml" 25 6]
+ [0: [0]])
+ B =
+ (apply (field 0 (global CamlinternalMod!)) [0: "anonymous.ml" 35 6]
+ [0: [0]]))
+ (seq (ignore (let (x = [0: 4 2]) (makeblock 0 x)))
+ (apply (field 1 (global CamlinternalMod!)) [0: [0]] A
+ (module-defn(A) anonymous.ml(23):567-608 A))
+ (apply (field 1 (global CamlinternalMod!)) [0: [0]] B
+ (module-defn(B) anonymous.ml(33):703-773
+ (let (x = [0: "foo" "bar"]) (makeblock 0))))
+ (let (f = (function param 0a)) (makeblock 0 A B f)))))
diff --git a/testsuite/tests/basic-modules/anonymous.ocamlopt.reference b/testsuite/tests/basic-modules/anonymous.ocamlopt.reference
new file mode 100644
index 0000000000..5b12141eef
--- /dev/null
+++ b/testsuite/tests/basic-modules/anonymous.ocamlopt.reference
@@ -0,0 +1,17 @@
+(seq (ignore (let (x = [0: 13 37]) (makeblock 0 x)))
+ (let
+ (A =
+ (apply (field 0 (global CamlinternalMod!)) [0: "anonymous.ml" 25 6]
+ [0: [0]])
+ B =
+ (apply (field 0 (global CamlinternalMod!)) [0: "anonymous.ml" 35 6]
+ [0: [0]]))
+ (seq (ignore (let (x = [0: 4 2]) (makeblock 0 x)))
+ (apply (field 1 (global CamlinternalMod!)) [0: [0]] A A)
+ (apply (field 1 (global CamlinternalMod!)) [0: [0]] B
+ (let (x = [0: "foo" "bar"]) (makeblock 0)))
+ (setfield_ptr(root-init) 0 (global Anonymous!) A)
+ (setfield_ptr(root-init) 1 (global Anonymous!) B)
+ (let (f = (function param 0a))
+ (setfield_ptr(root-init) 2 (global Anonymous!) f))
+ 0a)))
diff --git a/testsuite/tests/basic-modules/ocamltests b/testsuite/tests/basic-modules/ocamltests
index 57fba04f1d..bbfd924ff5 100644
--- a/testsuite/tests/basic-modules/ocamltests
+++ b/testsuite/tests/basic-modules/ocamltests
@@ -1,2 +1,3 @@
+anonymous.ml
main.ml
recursive_module_evaluation_errors.ml