summaryrefslogtreecommitdiffstats
path: root/t/io.t
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2011-08-05 13:08:04 -0500
committerJesse Luehrs <doy@tozt.net>2011-08-05 13:08:04 -0500
commitadda4f43e39cff45cf4d443dd93216644fca3afa (patch)
treee05964d374b3a5a4e363f595f443eb46a058fe44 /t/io.t
parentc3986e8ee5e47ef7e10896d991b53a3836591ef6 (diff)
downloadpackage-stash-adda4f43e39cff45cf4d443dd93216644fca3afa.tar.gz
package-stash-adda4f43e39cff45cf4d443dd93216644fca3afa.zip
remove test numbers
Diffstat (limited to 't/io.t')
-rw-r--r--t/io.t51
1 files changed, 51 insertions, 0 deletions
diff --git a/t/io.t b/t/io.t
new file mode 100644
index 0000000..ecade2a
--- /dev/null
+++ b/t/io.t
@@ -0,0 +1,51 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use lib 't/lib';
+use Test::More;
+use Test::Fatal;
+
+{
+ package Foo;
+ open *foo, "<", $0;
+
+ sub foo { }
+}
+
+{
+ package Bar;
+ open *bar, "<", $0;
+
+ sub bar { }
+}
+
+use Package::Stash;
+
+{
+ my $stash = Package::Stash->new('Foo');
+ ok($stash->has_symbol('&foo'), "has &foo");
+ ok($stash->has_symbol('foo'), "has foo");
+ $stash->remove_symbol('&foo');
+ ok(!$stash->has_symbol('&foo'), "has &foo");
+ ok($stash->has_symbol('foo'), "has foo");
+}
+
+{
+ my $stash = Package::Stash->new('Bar');
+ ok($stash->has_symbol('&bar'), "has &bar");
+ ok($stash->has_symbol('bar'), "has bar");
+ $stash->remove_symbol('bar');
+ ok($stash->has_symbol('&bar'), "has &bar");
+ ok(!$stash->has_symbol('bar'), "has bar");
+}
+
+{
+ my $stash = Package::Stash->new('Baz');
+ is(exception {
+ $stash->add_symbol('baz', *Foo::foo{IO});
+ }, undef, "can add an IO symbol");
+ ok($stash->has_symbol('baz'), "has baz");
+ is($stash->get_symbol('baz'), *Foo::foo{IO}, "got the right baz");
+}
+
+done_testing;