Skip to content

Instantly share code, notes, and snippets.

@exodist
Created February 16, 2016 15:50
Show Gist options
  • Save exodist/183af8afdca738105418 to your computer and use it in GitHub Desktop.
Save exodist/183af8afdca738105418 to your computer and use it in GitHub Desktop.
commit 2572a88967feec18b0821c36fcf89813c01cf742
Author: Chad Granum <[email protected]>
Date: Tue Jul 15 23:10:37 2014 -0700
Fix ok() that should be a like()
diff --git a/dist/autouse/t/autouse.t b/dist/autouse/t/autouse.t
index 0c8ad20..74cad59 100644
--- a/dist/autouse/t/autouse.t
+++ b/dist/autouse/t/autouse.t
@@ -27,7 +27,7 @@ BEGIN {
use Test::More tests => 15;
ok( $ok1, "Function from package with custom 'import()' correctly imported" );
-ok( $ok2, qr/^autouse into different package attempted/ );
+like( $ok2, qr/^autouse into different package attempted/, "Catch autouse into different package" );
ok( isdual($!),
"Function imported via 'autouse' performs as expected");
commit 49397f68b6cdcf8815424873504e4252773afdef
Author: Chad Granum <[email protected]>
Date: Tue Jul 15 23:10:20 2014 -0700
Delay loading Test::More
diff --git a/dist/autouse/t/autouse.t b/dist/autouse/t/autouse.t
index 0a51ee0..0c8ad20 100644
--- a/dist/autouse/t/autouse.t
+++ b/dist/autouse/t/autouse.t
@@ -8,23 +8,27 @@ BEGIN {
}
}
-use Test::More tests => 15;
-
+my ($ok1, $ok2);
BEGIN {
require autouse;
eval {
"autouse"->import('Scalar::Util' => 'Scalar::Util::set_prototype(&$)');
};
- ok( !$@, "Function from package with custom 'import()' correctly imported" );
+ $ok1 = !$@;
eval {
"autouse"->import('Scalar::Util' => 'Foo::min');
};
- ok( $@, qr/^autouse into different package attempted/ );
+ $ok2 = $@;
"autouse"->import('Scalar::Util' => qw(isdual set_prototype(&$)));
}
+use Test::More tests => 15;
+
+ok( $ok1, "Function from package with custom 'import()' correctly imported" );
+ok( $ok2, qr/^autouse into different package attempted/ );
+
ok( isdual($!),
"Function imported via 'autouse' performs as expected");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment