diff --git a/test/ppx_deriving_qcheck/deriver/qcheck/test_textual.ml b/test/ppx_deriving_qcheck/deriver/qcheck/test_textual.ml index f30bedce..3df4b3da 100644 --- a/test/ppx_deriving_qcheck/deriver/qcheck/test_textual.ml +++ b/test/ppx_deriving_qcheck/deriver/qcheck/test_textual.ml @@ -860,6 +860,20 @@ let test_unused_variable () = in check_eq ~expected ~actual "deriving variant with unused fuel parameter" +(* Regression test: https://github.com/c-cube/qcheck/issues/269 *) +let test_faulty_is_rec_typ_in_variant () = + let expected = + [ + [%stri let rec gen_sized n = + QCheck.Gen.map (fun gen0 -> Foo gen0) (QCheck.Gen.list (gen_sized (n / 2)))]; + [%stri let gen = QCheck.Gen.sized gen_sized]; + [%stri let arb_sized n = QCheck.make @@ (gen_sized n)]; + [%stri let arb = QCheck.make @@ gen]; + ] + in + let actual = f @@ extract [%stri type t = Foo of t list] + in + check_eq ~expected ~actual "deriving rec type in a type constructor inside variant" let () = Alcotest.( @@ -907,5 +921,9 @@ let () = "deriving variant with unused fuel parameter" `Quick test_unused_variable; + test_case + "deriving rec type in a type constructor inside variant" + `Quick + test_faulty_is_rec_typ_in_variant; ] ); ])