File tree 1 file changed +25
-0
lines changed
test/ppx_deriving_qcheck/deriver/qcheck
1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -875,6 +875,27 @@ let test_faulty_is_rec_typ_in_variant () =
875
875
in
876
876
check_eq ~expected ~actual "deriving rec type in a type constructor inside variant"
877
877
878
+ let test_faulty_is_rec_constr_decl () =
879
+ let expected =
880
+ [
881
+ [% stri let rec gen_sized n =
882
+ match n with
883
+ | 0 -> QCheck.Gen .pure Foo
884
+ | _ ->
885
+ QCheck.Gen .frequency
886
+ [(1 , (QCheck.Gen .pure Foo ));
887
+ (1 ,
888
+ (QCheck.Gen .map (fun gen0 -> Bar { baz = gen0 })
889
+ (gen_sized (n / 2 ))))]];
890
+ [% stri let gen = QCheck.Gen .sized gen_sized ];
891
+ [% stri let arb_sized n = QCheck .make @@ (gen_sized n )];
892
+ [% stri let arb = QCheck .make @@ gen ];
893
+ ]
894
+ in
895
+ let actual = f @@ extract [% stri type t = Foo | Bar of { baz : t }]
896
+ in
897
+ check_eq ~expected ~actual "deriving rec type in a type constructor inside record"
898
+
878
899
let () =
879
900
Alcotest. (
880
901
run
@@ -925,5 +946,9 @@ let () =
925
946
"deriving rec type in a type constructor inside variant"
926
947
`Quick
927
948
test_faulty_is_rec_typ_in_variant ;
949
+ test_case
950
+ "deriving rec type in a type constructor inside record"
951
+ `Quick
952
+ test_faulty_is_rec_constr_decl ;
928
953
] );
929
954
])
You can’t perform that action at this time.
0 commit comments