summaryrefslogtreecommitdiff
path: root/t/basic.t
diff options
context:
space:
mode:
Diffstat (limited to 't/basic.t')
-rw-r--r--t/basic.t37
1 files changed, 37 insertions, 0 deletions
diff --git a/t/basic.t b/t/basic.t
new file mode 100644
index 0000000..da33b4e
--- /dev/null
+++ b/t/basic.t
@@ -0,0 +1,37 @@
+use strict;
+use warnings;
+
+use Test::More 0.88;
+
+{
+ package T;
+
+ use strict;
+ use warnings;
+
+ use lib 't/lib';
+
+ use Module::Implementation;
+ my $loader = Module::Implementation::build_loader_sub(
+ implementations => [ 'Impl1', 'Impl2' ],
+ symbols => ['return_42'],
+ );
+
+ ::is( $loader->(), 'T::Impl1', 'loader return loaded package name' );
+}
+
+{
+ ok( T->can('return_42'), 'T package has a return_42 sub' );
+ ok(
+ !T->can('return_package'),
+ 'T package does not have return_package sub - only copied requested symbols'
+ );
+ is( T::return_42(), 42, 'T::return_42 work as expected' );
+ is(
+ Module::Implementation::implementation_for('T'),
+ 'Impl1',
+ 'T::_implementation returns default implementation'
+ );
+}
+
+done_testing();