Home | History | Annotate | Download | only in features
      1 #                                                                    -*-perl-*-
      2 $description = "Test various types of escaping in makefiles.";
      3 
      4 $details = "\
      5 Make sure that escaping of `:' works in target names.
      6 Make sure escaping of whitespace works in target names.
      7 Make sure that escaping of '#' works.";
      8 
      9 
     10 close(MAKEFILE);
     11 
     12 
     13 # TEST 1
     14 
     15 run_make_test('
     16 $(path)foo : ; @echo "touch ($@)"
     17 
     18 foo\ bar: ; @echo "touch ($@)"
     19 
     20 sharp: foo\#bar.ext
     21 foo\#bar.ext: ; @echo "foo#bar.ext = ($@)"',
     22 	      '',
     23 	      'touch (foo)');
     24 
     25 # TEST 2: This one should fail, since the ":" is unquoted.
     26 
     27 run_make_test(undef,
     28 	      'path=pre:',
     29 	      "#MAKEFILE#:2: *** target pattern contains no `%'.  Stop.",
     30 	      512);
     31 
     32 # TEST 3: This one should work, since we escape the ":".
     33 
     34 run_make_test(undef,
     35 	      "'path=pre\\:'",
     36 	      'touch (pre:foo)');
     37 
     38 # TEST 4: This one should fail, since the escape char is escaped.
     39 
     40 run_make_test(undef,
     41 	      "'path=pre\\\\:'",
     42 	      "#MAKEFILE#:2: *** target pattern contains no `%'.  Stop.",
     43 	      512);
     44 
     45 # TEST 5: This one should work
     46 
     47 run_make_test(undef,
     48 	      "'foo bar'",
     49 	      'touch (foo bar)');
     50 
     51 # TEST 6: Test escaped comments
     52 
     53 run_make_test(undef,
     54 	      'sharp',
     55 	      'foo#bar.ext = (foo#bar.ext)');
     56 
     57 # This tells the test driver that the perl test script executed properly.
     58 1;
     59