From: Shawn M Moore Date: Sun, 13 Sep 2009 05:51:22 +0000 (+0900) Subject: Failing test for new exporter parameters X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=56b22421dae60c477cbb11df6c0568b5c89f3910;p=gitmo%2FMoose.git Failing test for new exporter parameters --- diff --git a/t/050_metaclasses/031_new_exporter_parameters.t b/t/050_metaclasses/031_new_exporter_parameters.t new file mode 100644 index 0000000..15a9f19 --- /dev/null +++ b/t/050_metaclasses/031_new_exporter_parameters.t @@ -0,0 +1,65 @@ +#!/usr/bin/perl +use strict; +use warnings; +use Test::More skip_all => "not implemented yet"; +#use Test::More tests => 2; + +my @init_meta_args; + +BEGIN { + package My::Moose; + use Moose::Exporter; + use Moose (); + + Moose::Exporter->setup_import_methods( + with_caller => ['has_rw'], + also => 'Moose', + extra_parameters => ['-attribute'], + ); + + sub has_rw { + my $caller = shift; + my $name = shift; + $caller->meta->add_attribute($name, is => 'rw', @_); + } + + sub init_meta { + my $self = shift; + my %args = @_; + + push @init_meta_args, \%args; + + my $attribute = $args{'-attribute'}; + my $meta = Moose->init_meta( + %args, + ); + + if ($attribute) { + $meta->add_attribute($attribute, is => 'rw'); + } + + return $meta; + } +} + +{ + package My::Moose::User; + BEGIN { My::Moose->import }; + + has_rw 'counter' => ( + isa => 'Int', + ); +} + +ok(My::Moose::User->meta->get_attribute('counter')->has_accessor, 'our exported sugar works'); + +{ + package My::Other::Moose::User; + BEGIN { + My::Moose->import( + -attribute => 'counter', + ); + }; +} + +ok(My::Moose::User->meta->get_attribute('counter')->has_accessor, 'our extra exporter option worked');