Skip to content

Commit

Permalink
Merge pull request #416 from n-osborne/record-same-fields-test-case
Browse files Browse the repository at this point in the history
Add test case for record with partially same fields
  • Loading branch information
n-osborne authored Dec 5, 2024
2 parents 650ce1d + 84a62e4 commit 74c2bb3
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/issues/dune.inc
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,27 @@
; Syntax sanity check
(run ocamlc -c %{dep:pattern_inlined_record.mli}))))

(rule
(deps
%{bin:gospel}
(:checker %{project_root}/test/utils/testchecker.exe))
(targets record_with_partially_same_fields.gospel)
(action
(with-outputs-to record_with_partially_same_fields.mli.output
(run %{checker} %{dep:record_with_partially_same_fields.mli}))))

(rule
(alias runtest)
(action
(diff record_with_partially_same_fields.mli record_with_partially_same_fields.mli.output)))

(rule
(alias test-cmis)
(action
(chdir %{project_root}
; Syntax sanity check
(run ocamlc -c %{dep:record_with_partially_same_fields.mli}))))

(rule
(deps
%{bin:gospel}
Expand Down
12 changes: 12 additions & 0 deletions test/issues/record_with_partially_same_fields.mli
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
(*@ type t = { a: bool; b: integer } *)
(*@ type r = { a: bool; c: integer } *)

val f : int -> bool
(*@ ensures let x = { a = true; b = 42 } in true
*)
(* {gospel_expected|
[125] File "record_with_partially_same_fields.mli", line 5, characters 20-40:
5 | (*@ ensures let x = { a = true; b = 42 } in true
^^^^^^^^^^^^^^^^^^^^
Error: The record field b does not exist.
|gospel_expected} *)

0 comments on commit 74c2bb3

Please sign in to comment.