From: Florian Ragwitz Date: Thu, 9 Apr 2009 00:07:57 +0000 (+0000) Subject: Test that quoted words aren't interpreted as keywords. X-Git-Tag: 0.005000~17 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c0ebfc1ec2da649a6158fc7563d186b80edbbd3a;p=p5sagit%2FDevel-Declare.git Test that quoted words aren't interpreted as keywords. --- diff --git a/t/quote.t b/t/quote.t new file mode 100644 index 0000000..2f2e930 --- /dev/null +++ b/t/quote.t @@ -0,0 +1,43 @@ +use strict; +use warnings; +use Test::More tests => 14; + +use Devel::Declare 'method' => sub {}; + +sub test_eval; + +TODO: { + local $TODO = "dd_ck_const doesn't special-case ops created in quotelike contexts"; + test_eval 'qr/method/'; + test_eval 'qq/method/'; + test_eval '/method/'; + test_eval 's/method//'; + test_eval '`method`'; + test_eval 'qx/method/'; + test_eval 'tr/method/METHOD/'; + + # these ones work OK + test_eval 'q/method/'; + test_eval "'method'"; + test_eval '"method"'; + test_eval 'qw/method/'; + test_eval '<'; +} + +sub test_eval { + my $what = shift; + eval $what; + ok !$@, "$what" or d($@); +} +{ + my %seen; + sub d { # diag the error the first time we get it + my $err = shift; + $err =~s/ at .*$//; + $seen{$err}++ or diag $err; + } +}