| 1 | #!./perl
|
|---|
| 2 |
|
|---|
| 3 | BEGIN {
|
|---|
| 4 | chdir 't' if -d 't';
|
|---|
| 5 | @INC = '../lib';
|
|---|
| 6 | }
|
|---|
| 7 |
|
|---|
| 8 | require './test.pl';
|
|---|
| 9 | plan(tests => 42);
|
|---|
| 10 |
|
|---|
| 11 | # compile time
|
|---|
| 12 |
|
|---|
| 13 | is('-' x 5, '-----', 'compile time x');
|
|---|
| 14 | is('-' x 3.1, '---', 'compile time 3.1');
|
|---|
| 15 | is('-' x 3.9, '---', 'compile time 3.9');
|
|---|
| 16 | is('-' x 1, '-', ' x 1');
|
|---|
| 17 | is('-' x 0, '', ' x 0');
|
|---|
| 18 | is('-' x -1, '', ' x -1');
|
|---|
| 19 | is('-' x undef, '', ' x undef');
|
|---|
| 20 | is('-' x "foo", '', ' x "foo"');
|
|---|
| 21 | is('-' x "3rd", '---', ' x "3rd"');
|
|---|
| 22 |
|
|---|
| 23 | is('ab' x 3, 'ababab', ' more than one char');
|
|---|
| 24 |
|
|---|
| 25 | # run time
|
|---|
| 26 |
|
|---|
| 27 | $a = '-';
|
|---|
| 28 | is($a x 5, '-----', 'run time x');
|
|---|
| 29 | is($a x 3.1, '---', ' x 3.1');
|
|---|
| 30 | is($a x 3.9, '---', ' x 3.9');
|
|---|
| 31 | is($a x 1, '-', ' x 1');
|
|---|
| 32 | is($a x 0, '', ' x 0');
|
|---|
| 33 | is($a x -3, '', ' x -3');
|
|---|
| 34 | is($a x undef, '', ' x undef');
|
|---|
| 35 | is($a x "foo", '', ' x "foo"');
|
|---|
| 36 | is($a x "3rd", '---', ' x "3rd"');
|
|---|
| 37 |
|
|---|
| 38 | $a = 'ab';
|
|---|
| 39 | is($a x 3, 'ababab', ' more than one char');
|
|---|
| 40 | $a = 'ab';
|
|---|
| 41 | is($a x 0, '', ' more than one char');
|
|---|
| 42 | $a = 'ab';
|
|---|
| 43 | is($a x -12, '', ' more than one char');
|
|---|
| 44 |
|
|---|
| 45 | $a = 'xyz';
|
|---|
| 46 | $a x= 2;
|
|---|
| 47 | is($a, 'xyzxyz', 'x=2');
|
|---|
| 48 | $a x= 1;
|
|---|
| 49 | is($a, 'xyzxyz', 'x=1');
|
|---|
| 50 | $a x= 0;
|
|---|
| 51 | is($a, '', 'x=0');
|
|---|
| 52 |
|
|---|
| 53 | @x = (1,2,3);
|
|---|
| 54 |
|
|---|
| 55 | is(join('', @x x 4), '3333', '@x x Y');
|
|---|
| 56 | is(join('', (@x) x 4), '123123123123', '(@x) x Y');
|
|---|
| 57 | is(join('', (@x,()) x 4), '123123123123', '(@x,()) x Y');
|
|---|
| 58 | is(join('', (@x,1) x 4), '1231123112311231', '(@x,1) x Y');
|
|---|
| 59 | is(join(':', () x 4), '', '() x Y');
|
|---|
| 60 | is(join(':', (9) x 4), '9:9:9:9', '(X) x Y');
|
|---|
| 61 | is(join(':', (9,9) x 4), '9:9:9:9:9:9:9:9', '(X,X) x Y');
|
|---|
| 62 | is(join('', (split(//,"123")) x 2), '123123', 'split and x');
|
|---|
| 63 |
|
|---|
| 64 | is(join('', @x x -12), '', '@x x -12');
|
|---|
| 65 | is(join('', (@x) x -14), '', '(@x) x -14');
|
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 | # This test is actually testing for Digital C compiler optimizer bug,
|
|---|
| 69 | # present in Dec C versions 5.* and 6.0 (used in Digital UNIX and VMS),
|
|---|
| 70 | # found in December 1998. The bug was reported to Digital^WCompaq as
|
|---|
| 71 | # DECC 2745 (21-Dec-1998)
|
|---|
| 72 | # GEM_BUGS 7619 (23-Dec-1998)
|
|---|
|
|---|