Avoid potentially empty struct.
[p5sagit/p5-mst-13.2.git] / t / op / range.t
index 01f5f70..e8aecf5 100755 (executable)
@@ -1,6 +1,6 @@
 #!./perl
 
-print "1..12\n";
+print "1..15\n";
 
 print join(':',1..5) eq '1:2:3:4:5' ? "ok 1\n" : "not ok 1\n";
 
@@ -55,3 +55,21 @@ print "ok 11\n";
 print "not " unless "@a" eq "-2147483647 -2147483646";
 print "ok 12\n";
 
+# check magic
+{
+    my $bad = 0;
+    local $SIG{'__WARN__'} = sub { $bad = 1 };
+    my $x = 'a-e';
+    $x =~ s/(\w)-(\w)/join ':', $1 .. $2/e;
+    $bad = 1 unless $x eq 'a:b:c:d:e';
+    print $bad ? "not ok 13\n" : "ok 13\n";
+}
+
+# Should use magical autoinc only when both are strings
+print "not " unless 0 == (() = "0"..-1);
+print "ok 14\n";
+
+for my $x ("0"..-1) {
+    print "not ";
+}
+print "ok 15\n";