Skip to content

Commit

Permalink
Rewrite tests to be system agnostic.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim-ats-d committed Sep 7, 2022
1 parent 7e4967c commit 5a0189e
Showing 1 changed file with 9 additions and 25 deletions.
34 changes: 9 additions & 25 deletions test/test_ppx_system.ml
Original file line number Diff line number Diff line change
@@ -1,26 +1,10 @@
(* Written to work on Linux. *)

assert (match [%get_system] with Unix -> true | _ -> false);

assert (String.equal "xdg-open" [%system { unix = "xdg-open" }]);

assert (
String.equal "UNIX"
[%system
{
darwin = "Darwin";
free_bsd = "FreeBSD";
net_bsd = "NetBSD";
open_bsd = "OpenBSD";
unix = "UNIX";
win32 = "Win32";
}]);

assert (String.equal "open" [%system { default = "open" }]);

assert (
String.equal "xdg-open" [%system { darwin = "open"; default = "xdg-open" }]);

assert (
String.equal "xdg-open"
[%system { darwin = "open"; unix = "xdg-open"; win32 = "open" }])
match [%get_system] with
| Darwin when [%system { darwin = "darwin" }] = "darwin" -> true
| FreeBSD when [%system { free_bsd = "free_bsd" }] = "free_bsd" -> true
| NetBSD when [%system { net_bsd = "net_bsd" }] = "net_bsd" -> true
| OpenBSD when [%system { open_bsd = "open_bsd" }] = "open_bsd" -> true
| Unix when [%system { unix = "unix" }] = "unix" -> true
| Win32 when [%system { win32 = "win32" }] = "win32" -> true
| Unknown _ when [%system { darwin = "darwin" }] = "" -> true
| _ -> false)

0 comments on commit 5a0189e

Please sign in to comment.