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
|
#!/usr/bin/perl
# Unit testing for PPI, generated by Test::Inline
use strict;
use File::Spec::Functions ':ALL';
BEGIN {
$| = 1;
$^W = 1;
no warnings 'once';
$PPI::XS_DISABLE = 1;
$PPI::Lexer::X_TOKENIZER ||= $ENV{X_TOKENIZER};
}
use PPI;
# Execute the tests
use Test::More tests => 15;
# =begin testing string 15
{
# Prove what we say in the ->string docs
my $Document = PPI::Document->new(\<<'END_PERL');
'foo'
"foo"
q{foo}
qq <foo>
END_PERL
isa_ok( $Document, 'PPI::Document' );
my $quotes = $Document->find('Token::Quote');
is( ref($quotes), 'ARRAY', 'Found quotes' );
is( scalar(@$quotes), 4, 'Found 4 quotes' );
foreach my $Quote ( @$quotes ) {
isa_ok( $Quote, 'PPI::Token::Quote');
can_ok( $Quote, 'string' );
is( $Quote->string, 'foo', '->string returns "foo" for '
. $Quote->content );
}
}
1;
|