#!/usr/bin/perl use lib 'lib'; use strict; use warnings; use MyHolder; use Moose::Autobox; use Test::More tests => 6; BEGIN { use_ok( 'MyHolder' ); } my $cup_holder = MyHolder->new(); # name $cup_holder->name("cupboard"); is ($cup_holder->name(), "cupboard", "name of cup holder should be cupboard"); # things my @cups = qw(blue green green yellow); $cup_holder->things(\@cups); is ($cup_holder->things->length, 4, "there should be four things in the cupboard"); # add an element to the array $cup_holder->things->push("red"); is ($cup_holder->things->length, 5, "there should be five things in the cupboard"); # remove the last element from the array my $thing = $cup_holder->things->pop; is ($cup_holder->things->length, 4, "there should be four things in the cupboard"); is ($thing, "red", "the cup should be red");