1 1.1 christos # -*-perl-*- 2 1.1 christos $description = "Test the if function.\n"; 3 1.1 christos 4 1.1 christos $details = "Try various uses of if and ensure they all give the correct 5 1.1 christos results.\n"; 6 1.1 christos 7 1.1 christos open(MAKEFILE, "> $makefile"); 8 1.1 christos 9 1.1 christos print MAKEFILE <<EOMAKE; 10 1.1 christos NEQ = \$(subst \$1,,\$2) 11 1.1 christos e = 12 1.1 christos 13 1.1 christos all: 14 1.1 christos \t\@echo 1 \$(if ,true,false) 15 1.1 christos \t\@echo 2 \$(if ,true,) 16 1.1 christos \t\@echo 3 \$(if ,true) 17 1.1 christos \t\@echo 4 \$(if z,true,false) 18 1.1 christos \t\@echo 5 \$(if z,true,\$(shell echo hi)) 19 1.1 christos \t\@echo 6 \$(if ,\$(shell echo hi),false) 20 1.1 christos \t\@echo 7 \$(if \$(call NEQ,a,b),true,false) 21 1.1 christos \t\@echo 8 \$(if \$(call NEQ,a,a),true,false) 22 1.1 christos \t\@echo 9 \$(if z,true,fal,se) hi 23 1.1 christos \t\@echo 10 \$(if ,true,fal,se)there 24 1.1 christos \t\@echo 11 \$(if \$(e) ,true,false) 25 1.1 christos EOMAKE 26 1.1 christos 27 1.1 christos close(MAKEFILE); 28 1.1 christos 29 1.1 christos &run_make_with_options($makefile, "", &get_logfile); 30 1.1 christos $answer = "1 false\n2\n3\n4 true\n5 true\n6 false\n7 true\n8 false\n9 true hi\n10 fal,sethere\n11 false\n"; 31 1.1 christos &compare_output($answer, &get_logfile(1)); 32 1.1 christos 33 1.1 christos 1; 34