> Author: kyle
> Date: 2009-07-04 19:26:48 +0200 (Sat, 04 Jul 2009)
> New Revision: 27404
> [t] Further mutated t/syntax/hyper_latin1.t
> Modified: t/syntax/hyper_latin1.t
> --- t/syntax/hyper_latin1.t 2009-07-04 16:51:35 UTC (rev 27403)
> +++ t/syntax/hyper_latin1.t 2009-07-04 17:26:48 UTC (rev 27404)
> @@ -2,7 +2,7 @@
> use Test;
> -plan 3;
> +plan 5;
> # Unicode-version of >>~<< only works in utf8 encoded files
> # * Almost all other files in the Pugs Subversion repository are utf-8
> @@ -15,10 +15,16 @@
> # According to lwall, failure is the desired behaviour. To use latin1
> # in source code, explicitly declare it as such with the `encoding` pragma.
> -my $hyper_utf = eval "(<a b c>) \c187~\c171 (1,2,3)";
> -ok($!, 'latin1 should not be parsed');
> +my $latin1_encoded = "(<a b c>) \c187~\c171 (1,2,3)";
> +my $ASCII_encoded = "(<a b c>) >>~<< (1,2,3)";
> +my $utf8_encoded = "(<a b c>) »~« (1,2,3)";
This won't work that way (it didn't work before, either).
The reason is that \c187 is a Str level interpolation, which means that
\c187 creates an encoding-agnostic '»'.
IMHO the test should look like this:
eval_dies_ok '@a »~«'.encode('ISO-8859-1'),
'Latin-1 french quotes are a parse error';
Of course that implies that eval() and eval_dies_ok accept not only
Str's but also Buf's, which is (at least in the case of eval()) sensible.
If nobody objects, I'll update the spec and the tests.