Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests: Added more test coverage for not #12

Merged
merged 2 commits into from
Mar 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion config/ppx.t/cond_type_var_constructor.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,31 @@ type band =
| Rush
| Yes
| KingCrimson [@config (made_up = true)]
| TheXX [@config (not (value = "1"))]
| TheWho [@config (not (the_who))]
| Beatles [@config (not (value = true))]

(* this pattern matching is exhaustive because the config removes the
KingCrimson constructor *)
KingCrimson & TheXX constructor *)
let best_band_in_the_world x =
match x with
| Rush -> true
| Yes -> false
| TheWho -> false
| Beatles -> false

type band_polyvar = [
| `Rush
| `Yes
| `KingCrimson [@config (made_up=true)]
| `TheXX [@config (not (value = "1"))]
| `TheWho [@config (not (the_who))]
| `Beatles [@config (not (value = true))]
]

let the_best_band_in_the_world (x: band_polyvar) =
match x with
| `Rush -> true
| `Yes -> false
| `TheWho -> false
| `Beatles -> false
6 changes: 3 additions & 3 deletions config/ppx.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,14 @@
let () = Printf.printf "sys=%s env=%s" Sys.name Env.name

$ dune clean
$ target_os=windows target_arch=x86 target_env="" dune exec ./main.exe
$ value=1 target_os=windows target_arch=x86 target_env="" dune exec ./main.exe
sys=win32 env=unknown

$ dune clean
$ dune build
$ value=1 dune build

$ dune clean
$ target_os=madeup dune describe pp whole_mod.ml
$ value=1 target_os=madeup dune describe pp whole_mod.ml
[@@@ocaml.ppx.context
{
tool_name = "ppx_driver";
Expand Down