my $name = shift;
Moose->throw_error('Usage: has \'name\' => ( key => value, ... )')
- if @_ == 1;
+ if @_ % 2 == 1;
my %options = ( definition_context => _caller_info(), @_ );
my $attrs = ( ref($name) eq 'ARRAY' ) ? $name : [ ($name) ];
use strict;
use warnings;
-use Test::More tests => 47;
+use Test::More tests => 48;
use Test::Exception;
ok(OutOfClassTest->meta->get_attribute('foo'), 'attr created from sub call');
ok(OutOfClassTest->meta->get_attribute('bar'), 'attr created from can');
+
+
+{
+ {
+ package Foo;
+ use Moose;
+
+ ::throws_ok { has 'foo' => ( 'ro', isa => 'Str' ) }
+ qr/^Usage/, 'has throws error with odd number of attribute options';
+ }
+
+}