xref: /onnv-gate/usr/src/cmd/perl/5.8.4/distrib/t/op/qq.t (revision 0:68f95e015346)
1*0Sstevel@tonic-gate#!./perl
2*0Sstevel@tonic-gate
3*0Sstevel@tonic-gateBEGIN {
4*0Sstevel@tonic-gate    chdir 't' if -d 't';
5*0Sstevel@tonic-gate    @INC = '../lib';
6*0Sstevel@tonic-gate}
7*0Sstevel@tonic-gate
8*0Sstevel@tonic-gateprint q(1..21
9*0Sstevel@tonic-gate);
10*0Sstevel@tonic-gate
11*0Sstevel@tonic-gate# This is() function is written to avoid ""
12*0Sstevel@tonic-gatemy $test = 1;
13*0Sstevel@tonic-gatesub is {
14*0Sstevel@tonic-gate    my($left, $right) = @_;
15*0Sstevel@tonic-gate
16*0Sstevel@tonic-gate    if ($left eq $right) {
17*0Sstevel@tonic-gate      printf 'ok %d
18*0Sstevel@tonic-gate', $test++;
19*0Sstevel@tonic-gate      return 1;
20*0Sstevel@tonic-gate    }
21*0Sstevel@tonic-gate    foreach ($left, $right) {
22*0Sstevel@tonic-gate      # Comment out these regexps to map non-printables to ord if the perl under
23*0Sstevel@tonic-gate      # test is so broken that it's not helping
24*0Sstevel@tonic-gate      s/([^-+A-Za-z_0-9])/sprintf q{'.chr(%d).'}, ord $1/ge;
25*0Sstevel@tonic-gate      $_ = sprintf q('%s'), $_;
26*0Sstevel@tonic-gate      s/^''\.//;
27*0Sstevel@tonic-gate      s/\.''$//;
28*0Sstevel@tonic-gate    }
29*0Sstevel@tonic-gate    printf q(not ok %d - got %s expected %s
30*0Sstevel@tonic-gate), $test++, $left, $right;
31*0Sstevel@tonic-gate
32*0Sstevel@tonic-gate    printf q(# Failed test at line %d
33*0Sstevel@tonic-gate), (caller)[2];
34*0Sstevel@tonic-gate
35*0Sstevel@tonic-gate    return 0;
36*0Sstevel@tonic-gate}
37*0Sstevel@tonic-gate
38*0Sstevel@tonic-gateis ("\x53", chr 83);
39*0Sstevel@tonic-gateis ("\x4EE", chr (78) . 'E');
40*0Sstevel@tonic-gateis ("\x4i", chr (4) . 'i');	# This will warn
41*0Sstevel@tonic-gateis ("\xh", chr (0) . 'h');	# This will warn
42*0Sstevel@tonic-gateis ("\xx", chr (0) . 'x');	# This will warn
43*0Sstevel@tonic-gateis ("\xx9", chr (0) . 'x9');	# This will warn. \x9 is tab in EBCDIC too?
44*0Sstevel@tonic-gateis ("\x9_E", chr (9) . '_E');	# This will warn
45*0Sstevel@tonic-gate
46*0Sstevel@tonic-gateis ("\x{4E}", chr 78);
47*0Sstevel@tonic-gateis ("\x{6_9}", chr 105);
48*0Sstevel@tonic-gateis ("\x{_6_3}", chr 99);
49*0Sstevel@tonic-gateis ("\x{_6B}", chr 107);
50*0Sstevel@tonic-gate
51*0Sstevel@tonic-gateis ("\x{9__0}", chr 9);		# multiple underscores not allowed.
52*0Sstevel@tonic-gateis ("\x{77_}", chr 119);	# trailing underscore warns.
53*0Sstevel@tonic-gateis ("\x{6FQ}z", chr (111) . 'z');
54*0Sstevel@tonic-gate
55*0Sstevel@tonic-gateis ("\x{0x4E}", chr 0);
56*0Sstevel@tonic-gateis ("\x{x4E}", chr 0);
57*0Sstevel@tonic-gate
58*0Sstevel@tonic-gateis ("\x{0065}", chr 101);
59*0Sstevel@tonic-gateis ("\x{000000000000000000000000000000000000000000000000000000000000000072}",
60*0Sstevel@tonic-gate    chr 114);
61*0Sstevel@tonic-gateis ("\x{0_06_5}", chr 101);
62*0Sstevel@tonic-gateis ("\x{1234}", chr 4660);
63*0Sstevel@tonic-gateis ("\x{10FFFD}", chr 1114109);
64