4 # Ensure that syntax using colons (:) is parsed correctly.
5 # The tests are done on the following tokens (by default):
6 # ABC LABEL XYZZY m q qq qw qx s tr y AUTOLOAD and alarm
10 # Uncomment this for testing, but don't leave it in for "production", as
11 # we've not yet verified that use works.
14 $_ = ''; # to avoid undef warning on m// etc.
18 print "not " unless $ok;
22 $SIG{__WARN__} = sub { 1; }; # avoid some spurious warnings
26 ok 1, (eval "package ABC; sub zyx {1}; 1;" and
28 not eval "ABC:: eq ABC||" and
29 not eval "ABC::: >= 0");
31 ok 2, (eval "package LABEL; sub zyx {1}; 1;" and
33 not eval "LABEL:: eq LABEL||" and
34 not eval "LABEL::: >= 0");
36 ok 3, (eval "package XYZZY; sub zyx {1}; 1;" and
38 not eval "XYZZY:: eq XYZZY||" and
39 not eval "XYZZY::: >= 0");
41 ok 4, (eval "package m; sub zyx {1}; 1;" and
44 not eval "m::: >= 0");
46 ok 5, (eval "package q; sub zyx {1}; 1;" and
49 not eval "q::: >= 0");
51 ok 6, (eval "package qq; sub zyx {1}; 1;" and
52 not eval "qq::zyx" and
53 eval "qq:: eq qq||" and
54 not eval "qq::: >= 0");
56 ok 7, (eval "package qw; sub zyx {1}; 1;" and
57 not eval "qw::zyx" and
58 eval "qw:: eq qw||" and
59 not eval "qw::: >= 0");
61 ok 8, (eval "package qx; sub zyx {1}; 1;" and
62 not eval "qx::zyx" and
63 eval "qx:: eq qx||" and
64 not eval "qx::: >= 0");
66 ok 9, (eval "package s; sub zyx {1}; 1;" and
68 not eval "s:: eq s||" and
71 ok 10, (eval "package tr; sub zyx {1}; 1;" and
72 not eval "tr::zyx" and
73 not eval "tr:: eq tr||" and
76 ok 11, (eval "package y; sub zyx {1}; 1;" and
78 not eval "y:: eq y||" and
81 ok 12, (eval "ABC:1" and
82 not eval "ABC:echo: eq ABC|echo|" and
83 not eval "ABC:echo:ohce: >= 0");
85 ok 13, (eval "LABEL:1" and
86 not eval "LABEL:echo: eq LABEL|echo|" and
87 not eval "LABEL:echo:ohce: >= 0");
89 ok 14, (eval "XYZZY:1" and
90 not eval "XYZZY:echo: eq XYZZY|echo|" and
91 not eval "XYZZY:echo:ohce: >= 0");
93 ok 15, (not eval "m:1" and
94 eval "m:echo: eq m|echo|" and
95 not eval "m:echo:ohce: >= 0");
97 ok 16, (not eval "q:1" and
98 eval "q:echo: eq q|echo|" and
99 not eval "q:echo:ohce: >= 0");
101 ok 17, (not eval "qq:1" and
102 eval "qq:echo: eq qq|echo|" and
103 not eval "qq:echo:ohce: >= 0");
105 ok 18, (not eval "qw:1" and
106 eval "qw:echo: eq qw|echo|" and
107 not eval "qw:echo:ohce: >= 0");
109 ok 19, (not eval "qx:1" and
110 eval "qx:echo 1: eq qx|echo 1|" and # echo without args may warn
111 not eval "qx:echo:ohce: >= 0");
113 ok 20, (not eval "s:1" and
114 not eval "s:echo: eq s|echo|" and
115 eval "s:echo:ohce: >= 0");
117 ok 21, (not eval "tr:1" and
118 not eval "tr:echo: eq tr|echo|" and
119 eval "tr:echo:ohce: >= 0");
121 ok 22, (not eval "y:1" and
122 not eval "y:echo: eq y|echo|" and
123 eval "y:echo:ohce: >= 0");
125 ok 23, (not eval "AUTOLOAD:1" and
126 not eval "AUTOLOAD:echo: eq AUTOLOAD|echo|" and
127 not eval "AUTOLOAD:echo:ohce: >= 0");
129 ok 24, (not eval "and:1" and
130 not eval "and:echo: eq and|echo|" and
131 not eval "and:echo:ohce: >= 0");
133 ok 25, (not eval "alarm:1" and
134 not eval "alarm:echo: eq alarm|echo|" and
135 not eval "alarm:echo:ohce: >= 0");