diff options
author | Stephane Glondu <steph@glondu.net> | 2021-11-19 13:12:04 +0100 |
---|---|---|
committer | Stéphane Glondu <steph@glondu.net> | 2021-11-19 13:12:04 +0100 |
commit | 07d2c65d4f0867f0b41298175b5343fecf57bbad (patch) | |
tree | d3b6a60204864621a9f5532cf028b09212601ba3 /src_test | |
parent | a4f13db147f12dbf7b7e985b338162f4fda29e9c (diff) |
New upstream version 5.0
Diffstat (limited to 'src_test')
-rw-r--r-- | src_test/api/dune | 2 | ||||
-rw-r--r-- | src_test/api/test_api.cppo.ml | 5 | ||||
-rw-r--r-- | src_test/eq/test_deriving_eq.cppo.ml | 6 | ||||
-rw-r--r-- | src_test/fold/test_deriving_fold.cppo.ml | 6 | ||||
-rw-r--r-- | src_test/iter/test_deriving_iter.cppo.ml | 2 | ||||
-rw-r--r-- | src_test/map/test_deriving_map.cppo.ml | 8 | ||||
-rw-r--r-- | src_test/ord/test_deriving_ord.cppo.ml | 6 | ||||
-rw-r--r-- | src_test/show/test_deriving_show.cppo.ml | 10 |
8 files changed, 2 insertions, 43 deletions
diff --git a/src_test/api/dune b/src_test/api/dune index b5e850c..5a7ff92 100644 --- a/src_test/api/dune +++ b/src_test/api/dune @@ -6,4 +6,4 @@ (test (name test_api) (libraries oUnit compiler-libs.common ppx_deriving.api) - (preprocess (action (run ppxfind -legacy ppx_tools.metaquot --as-pp %{input-file})))) + (preprocess (pps ppxlib.metaquot))) diff --git a/src_test/api/test_api.cppo.ml b/src_test/api/test_api.cppo.ml index 8bdde64..edc6a43 100644 --- a/src_test/api/test_api.cppo.ml +++ b/src_test/api/test_api.cppo.ml @@ -2,13 +2,10 @@ open Parsetree open OUnit2 let string_of_tyvar tyvar = -#if OCAML_VERSION >= (4, 05, 0) tyvar.Location.txt -#else - tyvar -#endif let test_free_vars ctxt = + let loc = !Ast_helper.default_loc in let free_vars = Ppx_deriving.free_vars_in_core_type in let (!!) li = List.map string_of_tyvar li in let printer li = diff --git a/src_test/eq/test_deriving_eq.cppo.ml b/src_test/eq/test_deriving_eq.cppo.ml index eb76b73..231d773 100644 --- a/src_test/eq/test_deriving_eq.cppo.ml +++ b/src_test/eq/test_deriving_eq.cppo.ml @@ -38,9 +38,7 @@ let test_ref2 ctxt = type v = Foo | Bar of int * string | Baz of string [@@deriving eq] -#if OCAML_VERSION >= (4, 03, 0) type rv = RFoo | RBar of { x: int; y: string; } [@@deriving eq] -#endif type pv1 = [ `Foo | `Bar of int * string ] [@@deriving eq] type pv2 = [ `Baz | pv1 ] [@@deriving eq] @@ -133,13 +131,11 @@ end type 'a std_clash = 'a List.t option [@@deriving eq] -#if OCAML_VERSION >= (4, 03, 0) let test_result ctxt = let eq = [%eq: (string, int) result] in assert_equal ~printer true (eq (Ok "ttt") (Ok "ttt")); assert_equal ~printer false (eq (Ok "123") (Error 123)); assert_equal ~printer false (eq (Error 123) (Error 0)) -#endif let test_result_result ctxt = let open Result in @@ -159,9 +155,7 @@ let suite = "Test deriving(eq)" >::: [ "test_mut_rec" >:: test_mut_rec; "test_std_shadowing" >:: test_std_shadowing; "test_poly_app" >:: test_poly_app; -#if OCAML_VERSION >= (4, 03, 0) "test_result" >:: test_result; -#endif "test_result_result" >:: test_result_result; ] diff --git a/src_test/fold/test_deriving_fold.cppo.ml b/src_test/fold/test_deriving_fold.cppo.ml index be68404..e7ed05a 100644 --- a/src_test/fold/test_deriving_fold.cppo.ml +++ b/src_test/fold/test_deriving_fold.cppo.ml @@ -15,22 +15,18 @@ let test_reflist ctxt = let reflist = [ ref 3 ; ref 2 ; ref 1 ] in assert_equal ~printer:string_of_int 6 (fold_reflist (+) 0 reflist) -#if OCAML_VERSION >= (4, 03, 0) type 'a btreer = Node of { lft: 'a btree; elt: 'a; rgt: 'a btree } | Leaf [@@deriving fold] -#endif type 'a ty = 'a * int list [@@deriving fold] -#if OCAML_VERSION >= (4, 03, 0) type ('a, 'b) res = ('a, 'b) result [@@deriving fold] let test_result ctxt = let f = fold_res (+) (-) in assert_equal ~printer:string_of_int 1 (f 0 (Ok 1)); assert_equal ~printer:string_of_int (-1) (f 0 (Error 1)) -#endif type ('a, 'b) result_res = ('a, 'b) Result.result [@@deriving fold] @@ -41,9 +37,7 @@ let test_result_result ctxt = let suite = "Test deriving(fold)" >::: [ "test_btree" >:: test_btree; -#if OCAML_VERSION >= (4, 03, 0) "test_result" >:: test_result; -#endif "test_result_result" >:: test_result_result; "test_reflist" >:: test_reflist; ] diff --git a/src_test/iter/test_deriving_iter.cppo.ml b/src_test/iter/test_deriving_iter.cppo.ml index 6b05499..581c6d1 100644 --- a/src_test/iter/test_deriving_iter.cppo.ml +++ b/src_test/iter/test_deriving_iter.cppo.ml @@ -52,10 +52,8 @@ let test_reflist ctxt = [ ref 0 ; ref 1 ; ref 2 ] ; assert_equal [2;1;0] !lst -#if OCAML_VERSION >= (4, 03, 0) type 'a btreer = Node of { lft: 'a btree; elt: 'a; rgt: 'a btree } | Leaf [@@deriving iter] -#endif type 'a ty = 'a * int list [@@deriving iter] diff --git a/src_test/map/test_deriving_map.cppo.ml b/src_test/map/test_deriving_map.cppo.ml index d303638..d75e08b 100644 --- a/src_test/map/test_deriving_map.cppo.ml +++ b/src_test/map/test_deriving_map.cppo.ml @@ -5,10 +5,8 @@ module T : sig type 'a btree = Node of 'a btree * 'a * 'a btree | Leaf [@@deriving map, show] -#if OCAML_VERSION >= (4, 03, 0) type 'a btreer = Noder of { lft: 'a btree; elt: 'a; rgt: 'a btree } | Leafr [@@deriving map] -#endif type var0 = A0 of int [@@deriving map,show] @@ -36,10 +34,8 @@ end = struct type 'a btree = Node of 'a btree * 'a * 'a btree | Leaf [@@deriving map, show] -#if OCAML_VERSION >= (4, 03, 0) type 'a btreer = Noder of { lft: 'a btree; elt: 'a; rgt: 'a btree } | Leafr [@@deriving map] -#endif type 'a ty = 'a * int list [@@deriving map] @@ -143,7 +139,6 @@ let test_pvar3 ctxt = assert_equal ~printer:show `F (map `F); assert_equal ~printer:show `G (map `G) -#if OCAML_VERSION >= (4, 03, 0) type 'a result0 = ('a, bool) result [@@deriving show,map] let test_map_result ctxt = @@ -151,7 +146,6 @@ let test_map_result ctxt = let printer = show_result0 fmt_int in assert_equal ~printer (Ok 10) (f (Ok 9)); assert_equal ~printer (Error true) (f (Error true)) -#endif type 'a result_result0 = ('a, bool) Result.result [@@deriving show,map] @@ -173,9 +167,7 @@ let suite = "Test deriving(map)" >::: [ "test_record2" >:: test_record2; "test_record3" >:: test_record3; "test_pvar3" >:: test_pvar3; -#if OCAML_VERSION >= (4, 03, 0) "test_map_result" >:: test_map_result; -#endif "test_map_result_result" >:: test_map_result_result; ] diff --git a/src_test/ord/test_deriving_ord.cppo.ml b/src_test/ord/test_deriving_ord.cppo.ml index c247d6a..cc6a292 100644 --- a/src_test/ord/test_deriving_ord.cppo.ml +++ b/src_test/ord/test_deriving_ord.cppo.ml @@ -30,9 +30,7 @@ let test_variant ctxt = assert_equal ~printer (1) (compare_v (Baz "") (Bar (1, ""))); assert_equal ~printer (-1) (compare_v Foo (Baz "")) -#if OCAML_VERSION >= (4, 03, 0) type rv = RFoo | RBar of { x: int; y: string; } [@@deriving ord] -#endif type pv1 = [ `Foo | `Bar of int * string ] [@@deriving ord] type pv2 = [ `Baz | pv1 ] [@@deriving ord] @@ -101,13 +99,11 @@ let test_mrec2 ctxt = assert_equal ~printer (-1) (compare_e ce1 ce2); assert_equal ~printer (1) (compare_e ce2 ce1) -#if OCAML_VERSION >= (4, 03, 0) let test_ord_result ctx = let compare_res0 = [%ord: (unit, unit) result] in assert_equal ~printer 0 (compare_res0 (Ok ()) (Ok ())); assert_equal ~printer (-1) (compare_res0 (Ok ()) (Error ())); assert_equal ~printer 1 (compare_res0 (Error ()) (Ok ())) -#endif let test_ord_result_result ctx = let compare_res0 = [%ord: (unit, unit) Result.result] in @@ -192,9 +188,7 @@ let suite = "Test deriving(ord)" >::: [ "test_ref2" >:: test_ref2; "test_std_shadowing" >:: test_std_shadowing; "test_poly_app" >:: test_poly_app; -#if OCAML_VERSION >= (4, 03, 0) "test_ord_result" >:: test_ord_result; -#endif "test_ord_result_result" >:: test_ord_result_result; ] diff --git a/src_test/show/test_deriving_show.cppo.ml b/src_test/show/test_deriving_show.cppo.ml index 04043d7..59206d6 100644 --- a/src_test/show/test_deriving_show.cppo.ml +++ b/src_test/show/test_deriving_show.cppo.ml @@ -47,7 +47,6 @@ let test_variant ctxt = assert_equal ~printer "(Test_deriving_show.Bar (1, \"foo\"))" (show_v (Bar (1, "foo"))); assert_equal ~printer "(Test_deriving_show.Baz \"foo\")" (show_v (Baz "foo")) -#if OCAML_VERSION >= (4, 03, 0) type rv = RFoo | RBar of { x: int; y: string } | RBaz of { z: string } [@@deriving show] let test_variant_record ctxt = assert_equal ~printer "Test_deriving_show.RFoo" @@ -56,7 +55,6 @@ let test_variant_record ctxt = (show_rv (RBar {x=1; y="foo"})); assert_equal ~printer "(Test_deriving_show.RBaz {z = \"foo\"}" (show_rv (RBaz {z="foo"})) -#endif type vn = Foo of int option [@@deriving show] let test_variant_nest ctxt = @@ -85,7 +83,6 @@ let test_record ctxt = assert_equal ~printer "{ Test_deriving_show.f1 = 1; f2 = \"foo\"; f3 = <opaque> }" (show_re { f1 = 1; f2 = "foo"; f3 = 1.0 }) -#if OCAML_VERSION >= (4, 03, 0) type variant = Foo of { f1 : int; f2 : string; @@ -95,7 +92,6 @@ let test_variant_record ctxt = assert_equal ~printer "Test_deriving_show.Foo {f1 = 1; f2 = \"foo\"; f3 = <opaque>}" (show_variant (Foo { f1 = 1; f2 = "foo"; f3 = 1.0 })) -#endif module M : sig @@ -166,7 +162,6 @@ let test_mrec ctxt = assert_equal ~printer "(Test_deriving_show.B\n { Test_deriving_show.x = 12; r = (Test_deriving_show.F 16) })" (show_foo e1) -#if OCAML_VERSION >= (4, 03, 0) type i_has_result = I_has of (bool, string) result [@@deriving show] let test_result ctxt = @@ -176,7 +171,6 @@ let test_result ctxt = (show_i_has_result (I_has (Ok true))); assert_equal ~printer "(Test_deriving_show.I_has (Error \"err\"))" (show_i_has_result (I_has (Error "err"))) -#endif type i_has_result_result = I_has of (bool, string) Result.result [@@deriving show] @@ -259,9 +253,7 @@ let suite = "Test deriving(show)" >::: [ "test_poly" >:: test_poly; "test_poly_inherit" >:: test_poly_inherit; "test_record" >:: test_record; -#if OCAML_VERSION >= (4, 03, 0) "test_variant_record" >:: test_variant_record; -#endif "test_abstr" >:: test_abstr; "test_custom" >:: test_custom; "test_parametric" >:: test_parametric; @@ -273,9 +265,7 @@ let suite = "Test deriving(show)" >::: [ "test_poly_app" >:: test_poly_app; "test_variant_printer" >:: test_variant_printer; "test_paths" >:: test_paths_printer; -#if OCAML_VERSION >= (4, 03, 0) "test_result" >:: test_result; -#endif "test_result_result" >:: test_result_result; ] |