diff options
Diffstat (limited to 'antlr-3.4/runtime/Perl5/t/classes/Test/ANTLR/Runtime/ANTLRStringStream.pm')
-rw-r--r-- | antlr-3.4/runtime/Perl5/t/classes/Test/ANTLR/Runtime/ANTLRStringStream.pm | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/antlr-3.4/runtime/Perl5/t/classes/Test/ANTLR/Runtime/ANTLRStringStream.pm b/antlr-3.4/runtime/Perl5/t/classes/Test/ANTLR/Runtime/ANTLRStringStream.pm new file mode 100644 index 0000000..ab4a98b --- /dev/null +++ b/antlr-3.4/runtime/Perl5/t/classes/Test/ANTLR/Runtime/ANTLRStringStream.pm @@ -0,0 +1,32 @@ +package Test::ANTLR::Runtime::ANTLRStringStream; + +use ANTLR::Runtime::ANTLRStringStream; +use Test::More; + +use Moose; + +BEGIN { extends 'My::Test::Class' } + +sub consume : Test(2) { + my ($self) = @_; + + my $s = $self->class->new({ input => 'ABC' }); + is $s->LA(1), 'A'; + $s->consume(); + is $s->LA(1), 'B'; +} + +sub LA : Test(5) { + my ($self) = @_; + + my $s = $self->class->new({ input => 'ABC' }); + is $s->LA(0), undef; + is $s->LA(1), 'A'; + is $s->LA(2), 'B'; + is $s->LA(3), 'C'; + is $s->LA(4), ANTLR::Runtime::ANTLRStringStream->EOF; +} + +no Moose; +__PACKAGE__->meta->make_immutable(inline_constructor => 0); +1; |