summaryrefslogtreecommitdiffstats
path: root/t/33-moosex-globref.t
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2010-06-15 03:39:08 -0500
committerJesse Luehrs <doy@tozt.net>2010-06-15 03:39:08 -0500
commitdfc2ff5f2709f198d9fdb21d84a2534acc9f3670 (patch)
tree1e7792b6281cc26c634552d0b3a34ac73653fc62 /t/33-moosex-globref.t
parenteaf8ccad64a0ca7a5f69ce884753a395f4c196fc (diff)
downloadmoosex-nonmoose-dfc2ff5f2709f198d9fdb21d84a2534acc9f3670.tar.gz
moosex-nonmoose-dfc2ff5f2709f198d9fdb21d84a2534acc9f3670.zip
make more tests use with_immutable
Diffstat (limited to 't/33-moosex-globref.t')
-rw-r--r--t/33-moosex-globref.t62
1 files changed, 24 insertions, 38 deletions
diff --git a/t/33-moosex-globref.t b/t/33-moosex-globref.t
index be8c26b..3f59e39 100644
--- a/t/33-moosex-globref.t
+++ b/t/33-moosex-globref.t
@@ -2,6 +2,7 @@
use strict;
use warnings;
use Test::More;
+use Test::Moose;
BEGIN {
eval "use MooseX::GlobRef ()";
plan skip_all => "MooseX::GlobRef is required for this test" if $@;
@@ -58,42 +59,27 @@ has baz => (
sub FOREIGNBUILDARGS { return }
package main;
-my $handle = IO::Handle::Moose->new(bar => 'BAR');
-is($handle->bar, 'BAR', 'moose accessor works properly');
-$handle->bar('RAB');
-is($handle->bar, 'RAB', 'moose accessor works properly (setting)');
-IO::Handle::Moose->meta->make_immutable;
-$handle = IO::Handle::Moose->new(bar => 'BAR');
-is($handle->bar, 'BAR', 'moose accessor works properly');
-$handle->bar('RAB');
-is($handle->bar, 'RAB', 'moose accessor works properly (setting)');
-SKIP: {
- my $fh = IO::File::Moose->new(baz => 'BAZ');
- open $fh, "+>", undef
- or skip "couldn't open a temporary file", 3;
- is($fh->baz, 'BAZ', "accessor works");
- $fh->baz('ZAB');
- is($fh->baz, 'ZAB', "accessor works (writing)");
- $fh->print("foo\n");
- print $fh "bar\n";
- $fh->seek(0, 0);
- my $buf;
- $fh->read($buf, 8);
- is($buf, "foo\nbar\n", "filehandle still works as normal");
-}
-IO::File::Moose->meta->make_immutable;
-SKIP: {
- my $fh = IO::File::Moose->new(baz => 'BAZ');
- open $fh, "+>", undef
- or skip "couldn't open a temporary file", 3;
- is($fh->baz, 'BAZ', "accessor works");
- $fh->baz('ZAB');
- is($fh->baz, 'ZAB', "accessor works (writing)");
- $fh->print("foo\n");
- print $fh "bar\n";
- $fh->seek(0, 0);
- my $buf;
- $fh->read($buf, 8);
- is($buf, "foo\nbar\n", "filehandle still works as normal");
-}
+with_immutable {
+ my $handle = IO::Handle::Moose->new(bar => 'BAR');
+ is($handle->bar, 'BAR', 'moose accessor works properly');
+ $handle->bar('RAB');
+ is($handle->bar, 'RAB', 'moose accessor works properly (setting)');
+} 'IO::Handle::Moose';
+
+with_immutable {
+ SKIP: {
+ my $fh = IO::File::Moose->new(baz => 'BAZ');
+ open $fh, "+>", undef
+ or skip "couldn't open a temporary file", 3;
+ is($fh->baz, 'BAZ', "accessor works");
+ $fh->baz('ZAB');
+ is($fh->baz, 'ZAB', "accessor works (writing)");
+ $fh->print("foo\n");
+ print $fh "bar\n";
+ $fh->seek(0, 0);
+ my $buf;
+ $fh->read($buf, 8);
+ is($buf, "foo\nbar\n", "filehandle still works as normal");
+ }
+} 'IO::File::Moose';