summaryrefslogtreecommitdiff
path: root/t/op.repeat
diff options
context:
space:
mode:
Diffstat (limited to 't/op.repeat')
-rw-r--r--t/op.repeat32
1 files changed, 32 insertions, 0 deletions
diff --git a/t/op.repeat b/t/op.repeat
new file mode 100644
index 0000000000..1c03c31d9a
--- /dev/null
+++ b/t/op.repeat
@@ -0,0 +1,32 @@
+#!./perl
+
+# $Header: op.repeat,v 1.0 87/12/18 13:14:14 root Exp $
+
+print "1..11\n";
+
+# compile time
+
+if ('-' x 5 eq '-----') {print "ok 1\n";} else {print "not ok 1\n";}
+if ('-' x 1 eq '-') {print "ok 2\n";} else {print "not ok 2\n";}
+if ('-' x 0 eq '') {print "ok 3\n";} else {print "not ok 3\n";}
+
+if ('ab' x 3 eq 'ababab') {print "ok 4\n";} else {print "not ok 4\n";}
+
+# run time
+
+$a = '-';
+if ($a x 5 eq '-----') {print "ok 5\n";} else {print "not ok 5\n";}
+if ($a x 1 eq '-') {print "ok 6\n";} else {print "not ok 6\n";}
+if ($a x 0 eq '') {print "ok 7\n";} else {print "not ok 7\n";}
+
+$a = 'ab';
+if ($a x 3 eq 'ababab') {print "ok 8\n";} else {print "not ok 8\n";}
+
+$a = 'xyz';
+$a x= 2;
+if ($a eq 'xyzxyz') {print "ok 9\n";} else {print "not ok 9\n";}
+$a x= 1;
+if ($a eq 'xyzxyz') {print "ok 10\n";} else {print "not ok 10\n";}
+$a x= 0;
+if ($a eq '') {print "ok 11\n";} else {print "not ok 11\n";}
+