2 $description = "Test various types of escaping in makefiles.";
5 Make sure that escaping of `:' works in target names.
6 Also make sure escaping of whitespace works in target names";
8 open(MAKEFILE,"> $makefile");
10 print MAKEFILE <<'EOF';
11 $(path)foo : ; @echo cp $^ $@
13 foo\ bar: ; @echo 'touch "$@"'
21 &run_make_with_options($makefile, "", &get_logfile);
23 &compare_output($answer,&get_logfile(1));
25 # TEST 2: This one should fail, since the ":" is unquoted.
27 &run_make_with_options($makefile, "path=p:", &get_logfile, 512);
28 $answer = "$makefile:1: *** target pattern contains no `%'. Stop.\n";
29 &compare_output($answer,&get_logfile(1));
31 # TEST 3: This one should work, since we escape the ":".
33 &run_make_with_options($makefile, "'path=p\\:'", &get_logfile, 0);
34 $answer = "cp p:foo\n";
35 &compare_output($answer,&get_logfile(1));
37 # TEST 4: This one should fail, since the escape char is escaped.
39 &run_make_with_options($makefile, "'path=p\\\\:'", &get_logfile, 512);
40 $answer = "$makefile:1: *** target pattern contains no `%'. Stop.\n";
41 &compare_output($answer,&get_logfile(1));
43 # TEST 5: This one should work
45 &run_make_with_options($makefile, "'foo bar'", &get_logfile, 0);
46 $answer = "touch \"foo bar\"\n";
47 &compare_output($answer,&get_logfile(1));
49 # This tells the test driver that the perl test script executed properly.