test for load_module fixes
matthewt [Sun, 5 Dec 2010 19:22:58 +0000 (19:22 +0000)]
t/load_module.t [new file with mode: 0644]

diff --git a/t/load_module.t b/t/load_module.t
new file mode 100644 (file)
index 0000000..290f071
--- /dev/null
@@ -0,0 +1,18 @@
+use strictures 1;
+use Test::More;
+use Moo::_Utils;
+
+local @INC = (sub {
+  return unless $_[1] eq 'Foo/Bar.pm';
+  my $source = "package Foo::Bar; sub baz { 1 } 1";
+  open my $fh, '<', \$source;
+  $fh;
+}, @INC);
+
+{ package Foo::Bar::Baz; sub quux { } }
+
+_load_module("Foo::Bar");
+
+ok(eval { Foo::Bar->baz }, 'Loaded module ok');
+
+done_testing;