summaryrefslogtreecommitdiff
path: root/t/more-symbols.t
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2014-08-24 16:36:19 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2014-08-24 16:36:19 +0000
commitb808141b894ad538db75a7067e0199cbfe6337a9 (patch)
treeb3560724f86d6383c5ded5a79749c3f69592eb51 /t/more-symbols.t
downloadModule-Implementation-tarball-master.tar.gz
Module-Implementation-0.09HEADModule-Implementation-0.09master
Diffstat (limited to 't/more-symbols.t')
-rw-r--r--t/more-symbols.t47
1 files changed, 47 insertions, 0 deletions
diff --git a/t/more-symbols.t b/t/more-symbols.t
new file mode 100644
index 0000000..8bd8329
--- /dev/null
+++ b/t/more-symbols.t
@@ -0,0 +1,47 @@
+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 => [qw( return_42 &return_package $SCALAR @ARRAY %HASH )],
+ );
+
+ $loader->();
+}
+
+{
+ ok( T->can('return_42'), 'T package has a return_42 sub' );
+ ok( T->can('return_package'), 'T package has a return_package sub' );
+ is( T::return_42(), 42, 'T::return_42 work as expected' );
+ is(
+ T::return_package(),
+ 'T::Impl1',
+ 'T::return_package returns implementation package'
+ );
+
+ no warnings 'once';
+ is( $T::SCALAR, 42, '$T::SCALAR was copied from implementation' );
+ is_deeply(
+ \@T::ARRAY,
+ [ 1, 2, 3 ],
+ '@T::ARRAY was copied from implementation'
+ );
+ is_deeply(
+ \%T::HASH,
+ { key => 'val' },
+ '%T::HASH was copied from implementation'
+ );
+}
+
+done_testing();