VirtualBox

source: kBuild/vendor/gnumake/current/tests/scripts/features/escape@ 3208

最後變更 在這個檔案從3208是 3138,由 bird 提交於 7 年 前

Imported make 4.2.1 (2e55f5e4abdc0e38c1d64be703b446695e70b3b6) from https://git.savannah.gnu.org/git/make.git.

  • 屬性 svn:eol-style 設為 LF
檔案大小: 1.9 KB
 
1# -*-perl-*-
2$description = "Test various types of escaping in makefiles.";
3
4$details = "\
5Make sure that escaping of ':' works in target names.
6Make sure escaping of whitespace works in target names.
7Make sure that escaping of '#' works.
8Make sure that backslash before non-special characters are kept.";
9
10
11# TEST 1
12
13run_make_test('
14$(path)foo : ; @echo "touch ($@)"
15
16foo\ bar: ; @echo "touch ($@)"
17
18sharp: foo\#bar.ext
19foo\#bar.ext: ; @echo "foo#bar.ext = ($@)"',
20 '',
21 'touch (foo)');
22
23# TEST 2: This one should fail, since the ":" is unquoted.
24
25run_make_test(undef,
26 'path=pre:',
27 "#MAKEFILE#:2: *** target pattern contains no '%'. Stop.",
28 512);
29
30# TEST 3: This one should work, since we escape the ":".
31
32run_make_test(undef,
33 "'path=pre\\:'",
34 'touch (pre:foo)');
35
36# TEST 4: This one should fail, since the escape char is escaped.
37
38run_make_test(undef,
39 "'path=pre\\\\:'",
40 "#MAKEFILE#:2: *** target pattern contains no '%'. Stop.",
41 512);
42
43# TEST 5: This one should work
44
45run_make_test(undef,
46 "'foo bar'",
47 'touch (foo bar)');
48
49# TEST 6: Test escaped comments
50
51run_make_test(undef,
52 'sharp',
53 'foo#bar.ext = (foo#bar.ext)');
54
55# Test escaped colons in prerequisites
56# Quoting of backslashes in q!! is kind of messy.
57# Solaris sh does not properly handle backslashes even in '' so just
58# check the output make prints, not what the shell interprets.
59run_make_test(q!
60foo: foo\\:bar foo\\\\\\:bar foo\\\\\\\\\\:bar
61foo foo\\:bar foo\\\\\\:bar foo\\\\\\\\\\:bar: ; : '$@'
62!,
63 '', ": 'foo:bar'\n: 'foo\\:bar'\n: 'foo\\\\:bar'\n: 'foo'\n");
64
65# Test backslash before non-special chars: should be kept as-is
66
67run_make_test(q!
68all: ..\foo
69.DEFAULT: ; : '$@'
70!,
71 '', ": '..\\foo'\n");
72
73# This tells the test driver that the perl test script executed properly.
741;
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette