X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Fconstant.t;h=1f1d0be3d938906d3e525acef94f2b8d97b36ce3;hb=bc0bedcc9a054d550e68cd3ebd606b073b4151f7;hp=51902eb4ced6303c6169f9f543400c8ba000e51d;hpb=803b07a779c719a9176a69ed7eb5685bb9f23042;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/constant.t b/lib/constant.t index 51902eb..1f1d0be 100644 --- a/lib/constant.t +++ b/lib/constant.t @@ -14,23 +14,11 @@ END { print STDERR @warnings } use strict; -use Test::More tests => 74; +use Test::More tests => 75; my $TB = Test::More->builder; BEGIN { use_ok('constant'); } -sub test ($$;$) { - my($num, $bool, $diag) = @_; - if ($bool) { - print "ok $num\n"; - return; - } - print "not ok $num\n"; - return unless defined $diag; - $diag =~ s/\Z\n?/\n/; # unchomp - print map "# $num : $_", split m/^/m, $diag; -} - use constant PI => 4 * atan2 1, 1; ok defined PI, 'basic scalar constant'; @@ -245,3 +233,12 @@ is @{+FAMILY}, @{RFAM->[0]}; is FAMILY->[2], RFAM->[0]->[2]; is AGES->{FAMILY->[1]}, 28; is THREE**3, SPIT->(@{+FAMILY}**3); + +# Allow name of digits/underscores only if it begins with underscore +{ + use warnings FATAL => 'constant'; + eval q{ + use constant _1_2_3 => 'allowed'; + }; + ok( $@ eq '' ); +}