]> git.vpit.fr Git - perl/modules/subs-auto.git/blobdiff - t/10-base.t
Skip __LINE__ and __FILE__. Use __LINE__ in the tests
[perl/modules/subs-auto.git] / t / 10-base.t
index 12e758e231009756aab3a5babce00fca033e1b08..f3eaee68f99624b6ff6775fbfd218f40dc35219d 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 59;
+use Test::More tests => 60;
 
 my %_re = (
  bareword => sub { qr/^Bareword\s+['"]?\s*$_[0]\s*['"]?\s+not\s+allowed\s+while\s+["']?\s*strict\s+subs\s*['"]?\s+in\s+use\s+at\s+$_[1]\s+line\s+$_[2]/ },
@@ -70,7 +70,7 @@ _got_ok('compiling to wut()');
 use subs::auto;
 
 eval { onlycalledonce 1, 2 };
-_got_undefined('onlycalledonce', 72);
+_got_undefined('onlycalledonce', __LINE__-1);
 
 eval { Test::More->import() };
 _got_ok('don\'t touch class names');
@@ -101,7 +101,7 @@ _got_ok('compiling to wut(13,"what")');
 is($wut, 17, 'wut really was executed');
 
 eval { qux };
-_got_undefined('qux', 103);
+_got_undefined('qux', __LINE__-1);
 
 {
  no strict 'refs';
@@ -117,10 +117,10 @@ _got_undefined('qux', 103);
 }
 
 eval { no warnings; no strict; qux };
-_got_undefined('qux', 119);
+_got_undefined('qux', __LINE__-1);
 
 eval { no warnings; no strict; blech };
-_got_undefined('blech', 122);
+_got_undefined('blech', __LINE__-1);
 
 sub foo {
  if ($_[2]) {
@@ -160,10 +160,10 @@ is($blech, 7, 'blech really was executed');
 is($warn, undef, 'no redefine warning');
 
 eval { qux };
-_got_undefined('qux', 162);
+_got_undefined('qux', __LINE__-1);
 
 eval { blech };
-_got_undefined('blech', 165);
+_got_undefined('blech', __LINE__-1);
 
 # === Up to there =============================================================
 no subs::auto;
@@ -224,7 +224,7 @@ _got_undefined('blech', 1, eval => 1);
 
 sub blech;
 eval { blech };
-_got_undefined('blech', 226);
+_got_undefined('blech', __LINE__-1);
 
 sub flop;
 
@@ -244,3 +244,9 @@ sub yay { @yay = @_; '::yay' }
 # eval "meh";
 # _got_undefined('meh', 1, eval => 1, todo => 'Fails because of some bug in perl or Variable::Magic');
 }
+
+my $buf = '';
+open DONGS, '>', \$buf or die "open-in-memory: $!";
+print DONGS "hlagh\n";
+is($buf, "hlagh\n", 'filehandles should\'t be touched');
+close DONGS;