Skip to content

Commit

Permalink
add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
jmid committed Feb 23, 2023
1 parent 3c1f147 commit 5c6fddd
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/ppx_deriving_qcheck/deriver/qcheck/test_textual.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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.(
Expand Down Expand Up @@ -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;
] );
])

0 comments on commit 5c6fddd

Please sign in to comment.