]> git.vpit.fr Git - perl/modules/Scope-Upper.git/blobdiff - t/22-localize-block.t
Factor our verbose is() in Scope::Upper::TestGenerator
[perl/modules/Scope-Upper.git] / t / 22-localize-block.t
index b32d25113a8cc12a60270b13cd1f002efaad5a22..80dcc3841190959d6d0bfa685af9ef085e5a16c8 100644 (file)
@@ -19,7 +19,7 @@ local $Scope::Upper::TestGenerator::call = sub {
 local $Scope::Upper::TestGenerator::test = sub {
  my ($height, $level, $i, $x) = @_;
  my $j = ($i == $height - $level) ? 0 : (defined $x ? $x : 'undef');
- return "is(\$x, $j, 'x h=$height, l=$level, i=$i');\n";
+ return "verbose_is(\$x, $j, 'x h=$height, l=$level, i=$i');\n";
 };
 
 local $Scope::Upper::TestGenerator::local_test = sub { '' };
@@ -28,30 +28,12 @@ local $Scope::Upper::TestGenerator::allblocks = 1;
 
 our ($x, $testcase);
 
-{
- no warnings 'redefine';
- *is = sub ($$;$) {
-  my ($a, $b, $desc) = @_;
-  if (defined $testcase
-      and (defined $b) ? (not defined $a or $a != $b) : defined $a) {
-   diag <<DIAG;
-=== This testcase failed ===
-$testcase
-==== vvvvv Errors vvvvvv ===
-DIAG
-   undef $testcase;
-  }
-  Test::Leaner::is($a, $b, $desc);
- }
-}
-
 for my $level (0 .. 1) {
  my $height = $level + 1;
  my $tests = Scope::Upper::TestGenerator::gen($height, $level);
- for (@$tests) {
-  $testcase = $_;
+ for $testcase (@$tests) {
   $x = undef;
-  eval;
+  eval $testcase;
   diag $@ if $@;
  }
 }