diff options
author | Sébastien Hinderer <Sebastien.Hinderer@inria.fr> | 2017-12-19 17:19:34 +0100 |
---|---|---|
committer | Sébastien Hinderer <Sebastien.Hinderer@inria.fr> | 2018-01-17 12:04:42 +0100 |
commit | 80ccd98268664a8a6d738d5bda3705459feed467 (patch) | |
tree | bfa1189aea2847617a33fcb43bf13c0b8e09a3cc | |
parent | 3568faff6333b8154865f29b139bd8327fee734d (diff) | |
download | ocaml-80ccd98268664a8a6d738d5bda3705459feed467.tar.gz |
Migrate typing-private tests to ocamltest
-rw-r--r-- | testsuite/tests/typing-private/Makefile | 18 | ||||
-rw-r--r-- | testsuite/tests/typing-private/ocamltests | 1 | ||||
-rw-r--r-- | testsuite/tests/typing-private/private.compilers.principal.reference (renamed from testsuite/tests/typing-private/private.ml.principal.reference) | 87 | ||||
-rw-r--r-- | testsuite/tests/typing-private/private.compilers.reference (renamed from testsuite/tests/typing-private/private.ml.reference) | 87 | ||||
-rw-r--r-- | testsuite/tests/typing-private/private.ml | 5 |
5 files changed, 92 insertions, 106 deletions
diff --git a/testsuite/tests/typing-private/Makefile b/testsuite/tests/typing-private/Makefile deleted file mode 100644 index 7fc00661cb..0000000000 --- a/testsuite/tests/typing-private/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -#************************************************************************** -#* * -#* OCaml * -#* * -#* Xavier Clerc, SED, INRIA Rocquencourt * -#* * -#* Copyright 2010 Institut National de Recherche en Informatique et * -#* en Automatique. * -#* * -#* All rights reserved. This file is distributed under the terms of * -#* the GNU Lesser General Public License version 2.1, with the * -#* special exception on linking described in the file LICENSE. * -#* * -#************************************************************************** - -BASEDIR=../.. -include $(BASEDIR)/makefiles/Makefile.toplevel -include $(BASEDIR)/makefiles/Makefile.common diff --git a/testsuite/tests/typing-private/ocamltests b/testsuite/tests/typing-private/ocamltests new file mode 100644 index 0000000000..8f13acc41c --- /dev/null +++ b/testsuite/tests/typing-private/ocamltests @@ -0,0 +1 @@ +private.ml diff --git a/testsuite/tests/typing-private/private.ml.principal.reference b/testsuite/tests/typing-private/private.compilers.principal.reference index 39b9440f92..e8adbea972 100644 --- a/testsuite/tests/typing-private/private.ml.principal.reference +++ b/testsuite/tests/typing-private/private.compilers.principal.reference @@ -1,25 +1,24 @@ - -# module Foobar : sig type t = private int end -# module F0 : sig type t = private int end -# Characters 21-22: +module Foobar : sig type t = private int end +module F0 : sig type t = private int end +Characters 21-22: let f (x : F0.t) = (x : Foobar.t);; (* fails *) ^ Error: This expression has type F0.t but an expression was expected of type Foobar.t -# module F = Foobar -# val f : F.t -> Foobar.t = <fun> -# module M : sig type t = < m : int > end -# module M1 : sig type t = private < m : int; .. > end -# module M2 : sig type t = private < m : int; .. > end -# Characters 19-20: +module F = Foobar +val f : F.t -> Foobar.t = <fun> +module M : sig type t = < m : int > end +module M1 : sig type t = private < m : int; .. > end +module M2 : sig type t = private < m : int; .. > end +Characters 19-20: fun (x : M1.t) -> (x : M2.t);; (* fails *) ^ Error: This expression has type M1.t but an expression was expected of type M2.t -# module M3 : sig type t = private M1.t end -# - : M3.t -> M1.t = <fun> -# - : M3.t -> M.t = <fun> -# Characters 44-46: +module M3 : sig type t = private M1.t end +- : M3.t -> M1.t = <fun> +- : M3.t -> M.t = <fun> +Characters 44-46: module M4 : sig type t = private M3.t end = M2;; (* fails *) ^^ Error: Signature mismatch: @@ -31,7 +30,7 @@ Error: Signature mismatch: type t = M2.t is not included in type t = private M3.t -# Characters 44-45: +Characters 44-45: module M4 : sig type t = private M3.t end = M;; (* fails *) ^ Error: Signature mismatch: @@ -43,7 +42,7 @@ Error: Signature mismatch: type t = < m : int > is not included in type t = private M3.t -# Characters 44-46: +Characters 44-46: module M4 : sig type t = private M3.t end = M1;; (* might be ok *) ^^ Error: Signature mismatch: @@ -55,8 +54,8 @@ Error: Signature mismatch: type t = M1.t is not included in type t = private M3.t -# module M5 : sig type t = private M1.t end -# Characters 53-55: +module M5 : sig type t = private M1.t end +Characters 53-55: module M6 : sig type t = private < n:int; .. > end = M1;; (* fails *) ^^ Error: Signature mismatch: @@ -68,7 +67,7 @@ Error: Signature mismatch: type t = M1.t is not included in type t = private < n : int; .. > -# Characters 69-118: +Characters 69-118: struct type t = int let f (x : int) = (x : t) end;; (* must fail *) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: Signature mismatch: @@ -80,40 +79,40 @@ Error: Signature mismatch: type t = int is not included in type t = private Foobar.t -# module M : sig type t = private T of int val mk : int -> t end -# module M1 : sig type t = M.t val mk : int -> t end -# module M2 : sig type t = M.t val mk : int -> t end -# module M3 : sig type t = M.t val mk : int -> t end -# Characters 21-44: +module M : sig type t = private T of int val mk : int -> t end +module M1 : sig type t = M.t val mk : int -> t end +module M2 : sig type t = M.t val mk : int -> t end +module M3 : sig type t = M.t val mk : int -> t end +Characters 21-44: type t = M.t = T of int ^^^^^^^^^^^^^^^^^^^^^^^ Error: This variant or record definition does not match that of type M.t A private type would be revealed. -# module M5 : sig type t = M.t = private T of int val mk : int -> t end -# module M6 : sig type t = private T of int val mk : int -> t end -# module M' : +module M5 : sig type t = M.t = private T of int val mk : int -> t end +module M6 : sig type t = private T of int val mk : int -> t end +module M' : sig type t_priv = private T of int type t = t_priv val mk : int -> t end -# module M3' : sig type t = M'.t val mk : int -> t end -# module M : sig type 'a t = private T of 'a end -# module M1 : sig type 'a t = 'a M.t = private T of 'a end -# module Test : sig type t = private A end +module M3' : sig type t = M'.t val mk : int -> t end +module M : sig type 'a t = private T of 'a end +module M1 : sig type 'a t = 'a M.t = private T of 'a end +module Test : sig type t = private A end module Test2 : sig type t = Test.t = private A end -# val f : Test.t -> Test2.t = <fun> -# val f : Test2.t -> unit = <fun> -# Characters 8-15: +val f : Test.t -> Test2.t = <fun> +val f : Test2.t -> unit = <fun> +Characters 8-15: let a = Test2.A;; (* fail *) ^^^^^^^ Error: Cannot create values of the private type Test2.t -# * Characters 148-171: +Characters 148-171: module Test2 : module type of Test with type t = private Test.t = Test;; ^^^^^^^^^^^^^^^^^^^^^^^ Warning 3: deprecated: spurious use of private module Test2 : sig type t = Test.t = private A end -# type t = private < x : int; .. > -# type t = private < x : int; .. > -# type t = private < x : int > -# type t = private < x : int > -# Characters -1--1: +type t = private < x : int; .. > +type t = private < x : int; .. > +type t = private < x : int > +type t = private < x : int > +Characters -1--1: type 'a t = private < x : int; .. > as 'a;; Error: Type declarations do not match: @@ -121,7 +120,7 @@ Error: Type declarations do not match: is not included in type 'a t Their constraints differ. -# type 'a t = private 'a constraint 'a = < x : int; .. > -# type t = [ `Closed ] -# type nonrec t = private [> t ] -# +type 'a t = private 'a constraint 'a = < x : int; .. > +type t = [ `Closed ] +type nonrec t = private [> t ] + diff --git a/testsuite/tests/typing-private/private.ml.reference b/testsuite/tests/typing-private/private.compilers.reference index ace6cbdbd8..17a936b5d6 100644 --- a/testsuite/tests/typing-private/private.ml.reference +++ b/testsuite/tests/typing-private/private.compilers.reference @@ -1,25 +1,24 @@ - -# module Foobar : sig type t = private int end -# module F0 : sig type t = private int end -# Characters 21-22: +module Foobar : sig type t = private int end +module F0 : sig type t = private int end +Characters 21-22: let f (x : F0.t) = (x : Foobar.t);; (* fails *) ^ Error: This expression has type F0.t but an expression was expected of type Foobar.t -# module F = Foobar -# val f : F.t -> Foobar.t = <fun> -# module M : sig type t = < m : int > end -# module M1 : sig type t = private < m : int; .. > end -# module M2 : sig type t = private < m : int; .. > end -# Characters 19-20: +module F = Foobar +val f : F.t -> Foobar.t = <fun> +module M : sig type t = < m : int > end +module M1 : sig type t = private < m : int; .. > end +module M2 : sig type t = private < m : int; .. > end +Characters 19-20: fun (x : M1.t) -> (x : M2.t);; (* fails *) ^ Error: This expression has type M1.t but an expression was expected of type M2.t -# module M3 : sig type t = private M1.t end -# - : M3.t -> M1.t = <fun> -# - : M3.t -> M.t = <fun> -# Characters 44-46: +module M3 : sig type t = private M1.t end +- : M3.t -> M1.t = <fun> +- : M3.t -> M.t = <fun> +Characters 44-46: module M4 : sig type t = private M3.t end = M2;; (* fails *) ^^ Error: Signature mismatch: @@ -31,7 +30,7 @@ Error: Signature mismatch: type t = M2.t is not included in type t = private M3.t -# Characters 44-45: +Characters 44-45: module M4 : sig type t = private M3.t end = M;; (* fails *) ^ Error: Signature mismatch: @@ -43,7 +42,7 @@ Error: Signature mismatch: type t = < m : int > is not included in type t = private M3.t -# Characters 44-46: +Characters 44-46: module M4 : sig type t = private M3.t end = M1;; (* might be ok *) ^^ Error: Signature mismatch: @@ -55,8 +54,8 @@ Error: Signature mismatch: type t = M1.t is not included in type t = private M3.t -# module M5 : sig type t = private M1.t end -# Characters 53-55: +module M5 : sig type t = private M1.t end +Characters 53-55: module M6 : sig type t = private < n:int; .. > end = M1;; (* fails *) ^^ Error: Signature mismatch: @@ -68,7 +67,7 @@ Error: Signature mismatch: type t = M1.t is not included in type t = private < n : int; .. > -# Characters 69-118: +Characters 69-118: struct type t = int let f (x : int) = (x : t) end;; (* must fail *) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: Signature mismatch: @@ -80,40 +79,40 @@ Error: Signature mismatch: type t = int is not included in type t = private Foobar.t -# module M : sig type t = private T of int val mk : int -> t end -# module M1 : sig type t = M.t val mk : int -> t end -# module M2 : sig type t = M.t val mk : int -> t end -# module M3 : sig type t = M.t val mk : int -> t end -# Characters 21-44: +module M : sig type t = private T of int val mk : int -> t end +module M1 : sig type t = M.t val mk : int -> t end +module M2 : sig type t = M.t val mk : int -> t end +module M3 : sig type t = M.t val mk : int -> t end +Characters 21-44: type t = M.t = T of int ^^^^^^^^^^^^^^^^^^^^^^^ Error: This variant or record definition does not match that of type M.t A private type would be revealed. -# module M5 : sig type t = M.t = private T of int val mk : int -> t end -# module M6 : sig type t = private T of int val mk : int -> t end -# module M' : +module M5 : sig type t = M.t = private T of int val mk : int -> t end +module M6 : sig type t = private T of int val mk : int -> t end +module M' : sig type t_priv = private T of int type t = t_priv val mk : int -> t end -# module M3' : sig type t = M'.t val mk : int -> t end -# module M : sig type 'a t = private T of 'a end -# module M1 : sig type 'a t = 'a M.t = private T of 'a end -# module Test : sig type t = private A end +module M3' : sig type t = M'.t val mk : int -> t end +module M : sig type 'a t = private T of 'a end +module M1 : sig type 'a t = 'a M.t = private T of 'a end +module Test : sig type t = private A end module Test2 : sig type t = Test.t = private A end -# val f : Test.t -> Test2.t = <fun> -# val f : Test2.t -> unit = <fun> -# Characters 8-15: +val f : Test.t -> Test2.t = <fun> +val f : Test2.t -> unit = <fun> +Characters 8-15: let a = Test2.A;; (* fail *) ^^^^^^^ Error: Cannot create values of the private type Test2.t -# * Characters 148-171: +Characters 148-171: module Test2 : module type of Test with type t = private Test.t = Test;; ^^^^^^^^^^^^^^^^^^^^^^^ Warning 3: deprecated: spurious use of private module Test2 : sig type t = Test.t = private A end -# type t = private < x : int; .. > -# type t = private < x : int; .. > -# type t = private < x : int > -# type t = private < x : int > -# Characters -1--1: +type t = private < x : int; .. > +type t = private < x : int; .. > +type t = private < x : int > +type t = private < x : int > +Characters -1--1: type 'a t = private < x : int; .. > as 'a;; Error: Type declarations do not match: @@ -121,7 +120,7 @@ Error: Type declarations do not match: is not included in type 'a t Their constraints differ. -# type 'a t = private 'a constraint 'a = < x : int; .. > -# type t = [ `Closed ] -# type nonrec t = private [> t ] -# +type 'a t = private 'a constraint 'a = < x : int; .. > +type t = [ `Closed ] +type nonrec t = private [> t ] + diff --git a/testsuite/tests/typing-private/private.ml b/testsuite/tests/typing-private/private.ml index fd3b7bd7ba..bc55970851 100644 --- a/testsuite/tests/typing-private/private.ml +++ b/testsuite/tests/typing-private/private.ml @@ -1,3 +1,8 @@ +(* TEST + * toplevel + * toplevel with principal +*) + module Foobar : sig type t = private int end = struct |