diff options
author | Jesse Luehrs <doy@tozt.net> | 2013-09-04 19:38:21 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2013-09-04 19:47:11 -0400 |
commit | 8bf5e6931a1bd96df0cdb1ceb94bbb3e578a8126 (patch) | |
tree | 2e659a8f07ea1cca3091a9c0578bbd8e53c20c11 /t/33-moosex-globref.t | |
parent | 8e0b4f219f2d8d94cb6937ef47168ac5fac03cd9 (diff) | |
download | moosex-nonmoose-8bf5e6931a1bd96df0cdb1ceb94bbb3e578a8126.tar.gz moosex-nonmoose-8bf5e6931a1bd96df0cdb1ceb94bbb3e578a8126.zip |
packaging
Diffstat (limited to 't/33-moosex-globref.t')
-rw-r--r-- | t/33-moosex-globref.t | 88 |
1 files changed, 0 insertions, 88 deletions
diff --git a/t/33-moosex-globref.t b/t/33-moosex-globref.t deleted file mode 100644 index 60bfa9c..0000000 --- a/t/33-moosex-globref.t +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/env perl -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 $@; -} -# XXX: the way the IO modules are loaded means we can't just rely on cmop to -# load these properly/: -use IO::Handle; -use IO::File; - -BEGIN { - require Moose; - - package Foo::Exporter; - use Moose::Exporter; - Moose::Exporter->setup_import_methods(also => ['Moose']); - - sub init_meta { - shift; - my %options = @_; - Moose->init_meta(%options); - Moose::Util::MetaRole::apply_metaroles( - for => $options{for_class}, - class_metaroles => { - class => ['MooseX::NonMoose::Meta::Role::Class'], - constructor => - ['MooseX::NonMoose::Meta::Role::Constructor'], - instance => - ['MooseX::GlobRef::Role::Meta::Instance'], - }, - ); - return Class::MOP::class_of($options{for_class}); - } -} - -package IO::Handle::Moose; -BEGIN { Foo::Exporter->import } -extends 'IO::Handle'; - -has bar => ( - is => 'rw', - isa => 'Str', -); - -sub FOREIGNBUILDARGS { return } - -package IO::File::Moose; -BEGIN { Foo::Exporter->import } -extends 'IO::File'; - -has baz => ( - is => 'rw', - isa => 'Str', -); - -sub FOREIGNBUILDARGS { return } - -package main; - -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'; - -done_testing; |