| 1 |
# -*-perl-*- |
| 2 |
|
| 3 |
$description = "Run some negative tests (things that should fail)."; |
| 4 |
|
| 5 |
# TEST #0 |
| 6 |
# Check that non-terminated variable references are detected (and |
| 7 |
# reported using the best filename/lineno info |
| 8 |
run_make_test(' |
| 9 |
foo = bar |
| 10 |
x = $(foo |
| 11 |
y = $x |
| 12 |
|
| 13 |
all: ; @echo $y |
| 14 |
', |
| 15 |
'', '#MAKEFILE#:3: *** unterminated variable reference. Stop.', |
| 16 |
512); |
| 17 |
|
| 18 |
# TEST #1 |
| 19 |
# Bogus variable value passed on the command line. |
| 20 |
run_make_test(undef, |
| 21 |
['x=$(other'], |
| 22 |
'#MAKEFILE#:4: *** unterminated variable reference. Stop.', |
| 23 |
512); |
| 24 |
|
| 25 |
# TEST #2 |
| 26 |
# Again, but this time while reading the makefile. |
| 27 |
run_make_test(' |
| 28 |
foo = bar |
| 29 |
x = $(foo |
| 30 |
y = $x |
| 31 |
|
| 32 |
z := $y |
| 33 |
|
| 34 |
all: ; @echo $y |
| 35 |
', |
| 36 |
'', '#MAKEFILE#:3: *** unterminated variable reference. Stop.', |
| 37 |
512); |
| 38 |
|
| 39 |
# TEST #3 |
| 40 |
# Bogus variable value passed on the command line. |
| 41 |
run_make_test(undef, |
| 42 |
['x=$(other'], |
| 43 |
'#MAKEFILE#:4: *** unterminated variable reference. Stop.', |
| 44 |
512); |
| 45 |
|
| 46 |
# Whitespace not allowed in variable names |
| 47 |
run_make_test('x y =', '', |
| 48 |
'#MAKEFILE#:1: *** missing separator. Stop.', 512); |
| 49 |
|
| 50 |
run_make_test('x y=', '', |
| 51 |
'#MAKEFILE#:1: *** missing separator. Stop.', 512); |
| 52 |
|
| 53 |
# In theory an empty variable should be ignored, but during parsing it's a |
| 54 |
# real token and so this fails. I'm not 100% sure if this is right or not. |
| 55 |
|
| 56 |
run_make_test('x $X=', '', |
| 57 |
'#MAKEFILE#:1: *** missing separator. Stop.', 512); |
| 58 |
|
| 59 |
|
| 60 |
1; |