diff options
author | Jesse Luehrs <doy@tozt.net> | 2009-05-07 19:20:35 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2009-05-07 19:20:35 -0500 |
commit | 4fc4b9385dc28ad99559bc3b938594eedd4f3a21 (patch) | |
tree | 143147b7cc7f47026a9e89b19d9bc5ac8d920dd9 /t | |
parent | dbaed0adc3c5139718efd8a23588bfbcf02e11e5 (diff) | |
download | moosex-nonmoose-4fc4b9385dc28ad99559bc3b938594eedd4f3a21.tar.gz moosex-nonmoose-4fc4b9385dc28ad99559bc3b938594eedd4f3a21.zip |
add a test for mx-globref
Diffstat (limited to 't')
-rw-r--r-- | t/033-moosex-globref.t | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/t/033-moosex-globref.t b/t/033-moosex-globref.t new file mode 100644 index 0000000..9c20893 --- /dev/null +++ b/t/033-moosex-globref.t @@ -0,0 +1,49 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More; +BEGIN { + eval "use MooseX::GlobRef ()"; + plan skip_all => "MooseX::GlobRef is required for this test" if $@; + plan tests => 2; +} + +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_metaclass_roles( + for_class => $options{for_class}, + metaclass_roles => ['MooseX::NonMoose::Meta::Role::Class'], + constructor_class_roles => + ['MooseX::NonMoose::Meta::Role::Constructor'], + instance_metaclass_roles => + ['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 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)'); |