Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

bring in the tests from t/18import.t

  • Loading branch information...
commit d40bc658d13c3ec974835359318f9de65958127e 1 parent cce0d98
@book authored
Showing with 29 additions and 27 deletions.
  1. +29 −8 lib/Test/MetaSyntactic.pm
  2. +0 −19 t/18import.t
View
37 lib/Test/MetaSyntactic.pm
@@ -30,13 +30,14 @@ sub theme_ok {
$tb->subtest(
$theme,
sub {
- $tb->subtest( "load $theme", sub { subtest_load(@args); } );
- $tb->subtest( "format $theme", sub { subtest_format(@args); } );
- $tb->subtest( "uniq $theme", sub { subtest_uniq(@args); } );
- $tb->subtest( "length $theme", sub { subtest_length(@args); } );
- $tb->subtest( "data $theme", sub { subtest_data(@args); } );
- $tb->subtest( "import $theme", sub { subtest_import(@args); } );
- $tb->subtest( "theme $theme", sub { subtest_theme(@args); } );
+ $tb->subtest( "load $theme", sub { subtest_load(@args); } );
+ $tb->subtest( "format $theme", sub { subtest_format(@args); } );
+ $tb->subtest( "uniq $theme", sub { subtest_uniq(@args); } );
+ $tb->subtest( "length $theme", sub { subtest_length(@args); } );
+ $tb->subtest( "data $theme", sub { subtest_data(@args); } );
+ $tb->subtest( "import $theme", sub { subtest_import(@args); } );
+ $tb->subtest( "noimport $theme", sub { subtest_noimport(@args); } );
+ $tb->subtest( "theme $theme", sub { subtest_theme(@args); } );
$tb->done_testing;
}
);
@@ -155,6 +156,20 @@ sub subtest_import {
}
}
+# t/18import.t
+sub subtest_noimport {
+ my ($theme) = @_;
+ my $tb = __PACKAGE__->builder;
+ $tb->plan( tests => 1 );
+
+ eval "package Test::MetaSyntactic::EMPTY; use Acme::MetaSyntactic::$theme (); 1;"
+ or __PACKAGE__->builder->diag("$theme $@");
+
+ # meta$theme should not exist
+ eval "package Test::MetaSyntatic::EMPTY; meta$theme(1);";
+ $tb->ok( $@ =~ /^Undefined subroutine &Test::MetaSyntatic::EMPTY::meta$theme called/, "meta$theme function not exported" );
+}
+
# t/21format.t
sub subtest_format {
my ($theme) = @_;
@@ -312,7 +327,13 @@ properly formatted.
=head2 subtest_import( $theme )
-Checks that the exported C<meta$theme> function returns an item from C<$theme>.
+Checks that the exported C<meta$theme> function returns an item from
+C<$theme>.
+
+=head2 subtest_noimport( $theme )
+
+Checks that C<use Acme::MetaSyntactic::I<$theme> ()> does not export
+the C<meta$theme> function.
=head2 subtest_theme( $theme )
View
19 t/18import.t
@@ -1,19 +0,0 @@
-use Test::More tests => 2;
-use Acme::MetaSyntactic::batman ();
-use Acme::MetaSyntactic::haddock ();
-
-# metabatman should not exist
-eval { metabatman(1) };
-like(
- $@,
- qr/^Undefined subroutine &main::metabatman called/,
- "Function not exported"
-);
-
-# metahaddock should not exist
-eval { metahaddock(1) };
-like(
- $@,
- qr/^Undefined subroutine &main::metahaddock called/,
- "Function not exported"
-);
Please sign in to comment.
Something went wrong with that request. Please try again.