-
Notifications
You must be signed in to change notification settings - Fork 687
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# This is part of `prelude.mk`, split out for organizational purposes. | ||
# !!! NOTHING EAGER IS ALLOWED TO HAPPEN IN THIS FILE !!! | ||
|
||
# | ||
# Boolean support | ||
|
||
# $(TRUE) is a non-empty string; $(FALSE) is an empty string. | ||
TRUE = T | ||
FALSE = | ||
|
||
# Usage: $(call not,BOOL) | ||
not = $(if $1,$(FALSE),$(TRUE)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env bats | ||
|
||
load common | ||
|
||
@test "prelude_bool.mk: TRUE" { | ||
check_expr_eq strict '$(if $(TRUE),pass,fail)' 'pass' | ||
} | ||
|
||
@test "prelude_bool.mk: FALSE" { | ||
check_expr_eq strict '$(if $(FALSE),fail,pass)' 'pass' | ||
} | ||
|
||
@test "prelude_bool.mk: not TRUE" { | ||
check_expr_eq strict '$(if $(call not,$(TRUE)),fail,pass)' 'pass' | ||
} | ||
|
||
@test "prelude_bool.mk: not FALSE" { | ||
check_expr_eq strict '$(if $(call not,$(FALSE)),pass,fail)' 'pass' | ||
} | ||
|
||
@test "prelude_bool.mk: not truthy" { | ||
check_expr_eq strict '$(if $(call not,truthy),fail,pass)' 'pass' | ||
} |