| 1 | # -*-perl-*-
|
|---|
| 2 | $description = "Test the and & or functions.\n";
|
|---|
| 3 |
|
|---|
| 4 | $details = "Try various uses of and & or to ensure they all give the correct
|
|---|
| 5 | results.\n";
|
|---|
| 6 |
|
|---|
| 7 | # TEST #0
|
|---|
| 8 | # For $(and ...), it will either be empty or the last value
|
|---|
| 9 | run_make_test('
|
|---|
| 10 | NEQ = $(subst $1,,$2)
|
|---|
| 11 | f =
|
|---|
| 12 | t = true
|
|---|
| 13 |
|
|---|
| 14 | all:
|
|---|
| 15 | @echo 1 $(and ,$t)
|
|---|
| 16 | @echo 2 $(and $t)
|
|---|
| 17 | @echo 3 $(and $t,)
|
|---|
| 18 | @echo 4 $(and z,true,$f,false)
|
|---|
| 19 | @echo 5 $(and $t,$f,$(info bad short-circuit))
|
|---|
| 20 | @echo 6 $(and $(call NEQ,a,b),true)
|
|---|
| 21 | @echo 7 $(and $(call NEQ,a,a),true)
|
|---|
| 22 | @echo 8 $(and z,true,fal,se) hi
|
|---|
| 23 | @echo 9 $(and ,true,fal,se)there
|
|---|
| 24 | @echo 10 $(and $(e) ,$t)',
|
|---|
| 25 | '',
|
|---|
| 26 | "1\n2 true\n3\n4\n5\n6 true\n7\n8 se hi\n9 there\n10\n");
|
|---|
| 27 |
|
|---|
| 28 | # TEST #1
|
|---|
| 29 | # For $(or ...), it will either be empty or the first true value
|
|---|
| 30 | run_make_test('
|
|---|
| 31 | NEQ = $(subst $1,,$2)
|
|---|
| 32 | f =
|
|---|
| 33 | t = true
|
|---|
| 34 |
|
|---|
| 35 | all:
|
|---|
| 36 | @echo 1 $(or , )
|
|---|
| 37 | @echo 2 $(or $t)
|
|---|
| 38 | @echo 3 $(or ,$t)
|
|---|
| 39 | @echo 4 $(or z,true,$f,false)
|
|---|
| 40 | @echo 5 $(or $t,$(info bad short-circuit))
|
|---|
| 41 | @echo 6 $(or $(info short-circuit),$t)
|
|---|
| 42 | @echo 7 $(or $(call NEQ,a,b),true)
|
|---|
| 43 | @echo 8 $(or $(call NEQ,a,a),true)
|
|---|
| 44 | @echo 9 $(or z,true,fal,se) hi
|
|---|
| 45 | @echo 10 $(or ,true,fal,se)there
|
|---|
| 46 | @echo 11 $(or $(e) ,$f)',
|
|---|
| 47 | '',
|
|---|
| 48 | "short-circuit\n1\n2 true\n3 true\n4 z\n5 true\n6 true\n7 b\n8 true\n9 z hi\n10 truethere\n11\n");
|
|---|
| 49 |
|
|---|
| 50 | 1;
|
|---|