my ( $self, $i, $j, @elems ) = @_;
($container_type_constraint->check($_))
|| confess "Value " . (defined($_) ? $_ : 'undef') . " did not pass container type constraint" for @elems;
- CORE::splice @{$self->$reader()}, $i, $j, @elems;
+ CORE::splice @{$reader->($self)}, $i, $j, @elems;
};
}
else {
return sub {
my ( $self, $i, $j, @elems ) = @_;
- CORE::splice @{$self->$reader()}, $i, $j, @elems;
+ CORE::splice @{$reader->($self)}, $i, $j, @elems;
};
}
}
use strict;
use warnings;
-use Test::More tests => 62;
+use Test::More tests => 64;
use Test::Exception;
BEGIN {
'count' => 'num_options',
'empty' => 'has_options',
'clear' => 'clear_options',
+ 'splice' => 'splice_options',
'sort_in_place' => 'sort_options_in_place',
},
curries => {
$stuff->add_options_with_speed('compatible', 'safe');
} '... add options with speed okay';
-is_deeply($stuff->options, [qw/tree funrolls funbuns compatible safe/]);
+is_deeply($stuff->options, [qw/tree funrolls funbuns compatible safe/],
+ 'check options after add_options_with_speed');
lives_ok {
$stuff->prepend_prerequisites_along_with();
} '... add prerequisite options okay';
+$stuff->clear_options;
+$stuff->add_options( 1, 2 );
+
+lives_ok {
+ $stuff->splice_options( 1, 0, 'foo' );
+} '... splice_options works';
+
+is_deeply(
+ $stuff->options, [ 1, 'foo', 2 ],
+ 'splice added expected option'
+);
+
+
## check some errors
#dies_ok {
'count' => 'num_options',
'empty' => 'has_options',
'clear' => 'clear_options',
+ 'splice' => 'splice_options',
'sort_in_place' => 'sort_options_in_place',
}, '... got the right provides mapping');