summaryrefslogtreecommitdiff
path: root/tests/scripts/functions/if
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>1999-09-14 02:03:19 +0000
committerPaul Smith <psmith@gnu.org>1999-09-14 02:03:19 +0000
commit0d366b668244112846554c42045ff1d9956276ed (patch)
tree3802242fe18a5e90d889f5d1ac66fb487361888b /tests/scripts/functions/if
parent4121dea6a59367b4431cbe7a3c43d74fec9fd832 (diff)
downloadgunmake-0d366b668244112846554c42045ff1d9956276ed.tar.gz
* Added the test suite to the main distribution.
Diffstat (limited to 'tests/scripts/functions/if')
-rw-r--r--tests/scripts/functions/if31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/scripts/functions/if b/tests/scripts/functions/if
new file mode 100644
index 0000000..cb1f5fc
--- /dev/null
+++ b/tests/scripts/functions/if
@@ -0,0 +1,31 @@
+# -*-perl-*-
+$description = "Test the if function.\n";
+
+$details = "Try various uses of if and ensure they all give the correct
+results.\n";
+
+open(MAKEFILE, "> $makefile");
+
+print MAKEFILE <<EOMAKE;
+NEQ = \$(subst \$1,,\$2)
+
+all:
+\t\@echo \$(if ,true,false)
+\t\@echo \$(if ,true,)
+\t\@echo \$(if ,true)
+\t\@echo \$(if z,true,false)
+\t\@echo \$(if z,true,\$(shell echo hi))
+\t\@echo \$(if ,\$(shell echo hi),false)
+\t\@echo \$(if \$(call NEQ,a,b),true,false)
+\t\@echo \$(if \$(call NEQ,a,a),true,false)
+\t\@echo \$(if z,true,fal,se)
+\t\@echo \$(if ,true,fal,se)
+EOMAKE
+
+close(MAKEFILE);
+
+&run_make_with_options($makefile, "", &get_logfile);
+$answer = "false\n\n\ntrue\ntrue\nfalse\ntrue\nfalse\ntrue\nfal,se\n";
+&compare_output($answer, &get_logfile(1));
+
+1;