1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
package main;
use 5.006;
use strict;
use warnings;
use PPIx::QuoteLike::Utils qw{ __normalize_interpolation_for_ppi };
use Test::More 0.88; # Because of done_testing();
norm( '$foo', '$foo' );
norm( '$ foo', '$foo' );
norm( '${foo}', '$foo' );
norm( '${ foo }', '$foo' );
norm( '$ { foo }', '$foo' );
# NOTE this is a warning, and so (for now) not supported
# norm( '${foo{bar}}', '$foo{bar}' );
# NOTE this is a warning, and so (for now) not supported
# norm( '@{foo{bar}}', '@foo{bar}' );
norm( '@{$x[$i]}', '@{$x[$i]}' );
norm( '@{ [ foo() ] }', 'foo()' );
norm( '${ \\ ( foo() ) }', 'foo()' );
norm( '${^MATCH}', '${^MATCH}' );
norm( '${^CAPTURE[0]}', '${^CAPTURE[0]}' );
done_testing;
sub norm {
my ( $norm, $want, $title ) = @_;
defined $title
or $title = "'$norm' normalizes to '$want'";
my $got = __normalize_interpolation_for_ppi( $norm );
@_ = ( $got, $want, $title );
goto &is;
}
1;
# ex: set textwidth=72 :
|