From: Dave Rolsky Date: Sun, 31 Oct 2010 16:24:14 +0000 (-0500) Subject: Test that a lazy attr without a default or builder dies X-Git-Tag: 1.18~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bbf62397d81d046a716776f756249e22c4ddf372;p=gitmo%2FMoose.git Test that a lazy attr without a default or builder dies --- diff --git a/t/020_attributes/040_lazy_no_default.t b/t/020_attributes/040_lazy_no_default.t new file mode 100644 index 0000000..bb35a08 --- /dev/null +++ b/t/020_attributes/040_lazy_no_default.t @@ -0,0 +1,24 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Test::More; +use Test::Fatal; + +{ + package Foo; + use Moose; + + ::like( + ::exception{ has foo => ( + is => 'ro', + lazy => 1, + ); + }, + qr/\QYou cannot have a lazy attribute (foo) without specifying a default value for it/, + 'lazy without a default or builder throws an error' + ); +} + +done_testing;