Commit | Line | Data |
8d063cd8 |
1 | #!./perl |
2 | |
8d063cd8 |
3 | # tests that aren't important enough for base.term |
4 | |
0505442f |
5 | print "1..23\n"; |
8d063cd8 |
6 | |
7 | $x = "\\n"; |
8 | print "#1\t:$x: eq " . ':\n:' . "\n"; |
9 | if ($x eq '\n') {print "ok 1\n";} else {print "not ok 1\n";} |
10 | |
11 | $x = "#2\t:$x: eq :\\n:\n"; |
12 | print $x; |
13 | unless (index($x,'\\\\')>0) {print "ok 2\n";} else {print "not ok 2\n";} |
14 | |
15 | if (length('\\\\') == 2) {print "ok 3\n";} else {print "not ok 3\n";} |
16 | |
17 | $one = 'a'; |
18 | |
19 | if (length("\\n") == 2) {print "ok 4\n";} else {print "not ok 4\n";} |
20 | if (length("\\\n") == 2) {print "ok 5\n";} else {print "not ok 5\n";} |
21 | if (length("$one\\n") == 3) {print "ok 6\n";} else {print "not ok 6\n";} |
22 | if (length("$one\\\n") == 3) {print "ok 7\n";} else {print "not ok 7\n";} |
23 | if (length("\\n$one") == 3) {print "ok 8\n";} else {print "not ok 8\n";} |
24 | if (length("\\\n$one") == 3) {print "ok 9\n";} else {print "not ok 9\n";} |
378cc40b |
25 | if (length("\\${one}") == 2) {print "ok 10\n";} else {print "not ok 10\n";} |
8d063cd8 |
26 | |
a687059c |
27 | if ("${one}b" eq "ab") { print "ok 11\n";} else {print "not ok 11\n";} |
28 | |
29 | @foo = (1,2,3); |
30 | if ("$foo[1]b" eq "2b") { print "ok 12\n";} else {print "not ok 12\n";} |
31 | if ("@foo[0..1]b" eq "1 2b") { print "ok 13\n";} else {print "not ok 13\n";} |
32 | $" = '::'; |
33 | if ("@foo[0..1]b" eq "1::2b") { print "ok 14\n";} else {print "not ok 14\n";} |
b8a4b1be |
34 | |
35 | # test if C<eval "{...}"> distinguishes between blocks and hashrefs |
36 | |
37 | $a = "{ '\\'' , 'foo' }"; |
38 | $a = eval $a; |
39 | if (ref($a) eq 'HASH') {print "ok 15\n";} else {print "not ok 15\n";} |
40 | |
41 | $a = "{ '\\\\\\'abc' => 'foo' }"; |
42 | $a = eval $a; |
43 | if (ref($a) eq 'HASH') {print "ok 16\n";} else {print "not ok 16\n";} |
44 | |
45 | $a = "{'a\\\n\\'b','foo'}"; |
46 | $a = eval $a; |
47 | if (ref($a) eq 'HASH') {print "ok 17\n";} else {print "not ok 17\n";} |
48 | |
49 | $a = "{'\\\\\\'\\\\'=>'foo'}"; |
50 | $a = eval $a; |
51 | if (ref($a) eq 'HASH') {print "ok 18\n";} else {print "not ok 18\n";} |
52 | |
53 | $a = "{q,a'b,,'foo'}"; |
54 | $a = eval $a; |
55 | if (ref($a) eq 'HASH') {print "ok 19\n";} else {print "not ok 19\n";} |
56 | |
57 | $a = "{q[[']]=>'foo'}"; |
58 | $a = eval $a; |
59 | if (ref($a) eq 'HASH') {print "ok 20\n";} else {print "not ok 20\n";} |
60 | |
61 | # needs disambiguation if first term is a variable |
62 | $a = "+{ \$a , 'foo'}"; |
63 | $a = eval $a; |
64 | if (ref($a) eq 'HASH') {print "ok 21\n";} else {print "not ok 21\n";} |
65 | |
66 | $a = "+{ \$a=>'foo'}"; |
67 | $a = eval $a; |
68 | if (ref($a) eq 'HASH') {print "ok 22\n";} else {print "not ok 22\n";} |
0505442f |
69 | |
70 | $a = "{ 0x01 => 'foo'}->{0x01}"; |
71 | $a = eval $a; |
72 | if ($a eq 'foo') {print "ok 23\n";} else {print "not ok 23\n";} |