Skip to content

Commit

Permalink
add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
trefis committed Aug 8, 2018
1 parent 4a2b27a commit 176bed1
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions testsuite/tests/typing-modules/Test.ml
Expand Up @@ -121,3 +121,69 @@ Line 2, characters 0-3:
^^^
Error: The module F is a functor, it cannot have any components
|}];;

type t = ..;;
[%%expect{|
type t = ..
|}];;

module M : sig type t += E end = struct type t += E of int end;;
[%%expect{|
Line 1, characters 33-62:
module M : sig type t += E end = struct type t += E of int end;;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Signature mismatch:
Modules do not match:
sig type t += E of int end
is not included in
sig type t += E end
Extension declarations do not match:
type t += E of int
is not included in
type t += E
|}];;

module M : sig type t += E of char end = struct type t += E of int end;;
[%%expect{|
Line 1, characters 41-70:
module M : sig type t += E of char end = struct type t += E of int end;;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Signature mismatch:
Modules do not match:
sig type t += E of int end
is not included in
sig type t += E of char end
Extension declarations do not match:
type t += E of int
is not included in
type t += E of char
|}];;

module M : sig type t += C of int end = struct type t += E of int end;;
[%%expect{|
Line 1, characters 40-69:
module M : sig type t += C of int end = struct type t += E of int end;;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Signature mismatch:
Modules do not match:
sig type t += E of int end
is not included in
sig type t += C of int end
The extension constructor `C' is required but not provided
|}];;

module M : sig type t += E of { x : int } end = struct type t += E of int end;;
[%%expect{|
Line 1, characters 48-77:
module M : sig type t += E of { x : int } end = struct type t += E of int end;;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Signature mismatch:
Modules do not match:
sig type t += E of int end
is not included in
sig type t += E of { x : int; } end
Extension declarations do not match:
type t += E of int
is not included in
type t += E of { x : int; }
|}];;

0 comments on commit 176bed1

Please sign in to comment.