Skip to content

Commit

Permalink
Added test cases for not expression.
Browse files Browse the repository at this point in the history
  • Loading branch information
KFoxder committed Mar 3, 2024
1 parent daf8121 commit 2d21cf6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
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
8 changes: 4 additions & 4 deletions config/ppx.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -121,18 +121,18 @@
let () = Printf.printf "sys=%s env=%s" Sys.name Env.name

$ dune clean
$ dune exec ./main.exe
$ value=1 dune exec ./main.exe
sys=unix env=unknown

$ dune clean
$ target_os=windows target_arch=x86 dune exec ./main.exe
$ value=1 target_os=windows target_arch=x86 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

0 comments on commit 2d21cf6

Please sign in to comment.