Sync usage with man page.
[netbsd-mini2440.git] / gnu / dist / gmake / tests / scripts / functions / warning
blobac0ad64366aec990fd2eac3128dc43d3a90dc155
1 $description = "\
2 The following test creates a makefile to test the warning function.";
4 $details = "";
6 open(MAKEFILE,"> $makefile");
8 print MAKEFILE <<'EOF';
9 ifdef WARNING1
10 $(warning warning is $(WARNING1))
11 endif
13 ifdef WARNING2
14 $(warning warning is $(WARNING2))
15 endif
17 ifdef WARNING3
18 all: some; @echo hi $(warning warning is $(WARNING3))
19 endif
21 ifdef WARNING4
22 all: some; @echo hi
23         @echo there $(warning warning is $(WARNING4))
24 endif
26 some: ; @echo Some stuff
28 EOF
30 close(MAKEFILE);
32 # Test #1
34 &run_make_with_options($makefile, "WARNING1=yes", &get_logfile, 0);
35 $answer = "$makefile:2: warning is yes\nSome stuff\n";
36 &compare_output($answer,&get_logfile(1));
38 # Test #2
40 &run_make_with_options($makefile, "WARNING2=no", &get_logfile, 0);
41 $answer = "$makefile:6: warning is no\nSome stuff\n";
42 &compare_output($answer,&get_logfile(1));
44 # Test #3
46 &run_make_with_options($makefile, "WARNING3=maybe", &get_logfile, 0);
47 $answer = "Some stuff\n$makefile:10: warning is maybe\nhi\n";
48 &compare_output($answer,&get_logfile(1));
50 # Test #4
52 &run_make_with_options($makefile, "WARNING4=definitely", &get_logfile, 0);
53 $answer = "Some stuff\n$makefile:14: warning is definitely\nhi\nthere\n";
54 &compare_output($answer,&get_logfile(1));
56 # This tells the test driver that the perl test script executed properly.