| 1 |
#!/usr/bin/perl |
| 2 |
# Copyright 2022 Jeffrey Kegler |
| 3 |
# This file is part of Marpa::R2. Marpa::R2 is free software: you can |
| 4 |
# redistribute it and/or modify it under the terms of the GNU Lesser |
| 5 |
# General Public License as published by the Free Software Foundation, |
| 6 |
# either version 3 of the License, or (at your option) any later version. |
| 7 |
# |
| 8 |
# Marpa::R2 is distributed in the hope that it will be useful, |
| 9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 |
# Lesser General Public License for more details. |
| 12 |
# |
| 13 |
# You should have received a copy of the GNU Lesser |
| 14 |
# General Public License along with Marpa::R2. If not, see |
| 15 |
# http://www.gnu.org/licenses/. |
| 16 |
|
| 17 |
# Regressions tests involving the Stuizand interface |
| 18 |
|
| 19 |
use 5.010001; |
| 20 |
use strict; |
| 21 |
use warnings; |
| 22 |
use Test::More tests => 1; |
| 23 |
|
| 24 |
use lib 'inc'; |
| 25 |
use Marpa::R2::Test; |
| 26 |
|
| 27 |
## no critic (ErrorHandling::RequireCarping); |
| 28 |
|
| 29 |
use Marpa::R2; |
| 30 |
|
| 31 |
# Regression test of bug found by Andrew Rodland |
| 32 |
|
| 33 |
my $g = Marpa::R2::Grammar->new( |
| 34 |
{ actions => "main", |
| 35 |
start => "start", |
| 36 |
source => \"start ::= action => act" |
| 37 |
} |
| 38 |
); |
| 39 |
$g->precompute; |
| 40 |
my $r = Marpa::R2::Recognizer->new( { grammar => $g } ); |
| 41 |
my $value_ref = $r->value; |
| 42 |
my $value = defined $value_ref ? ${$value_ref} : 'No parse'; |
| 43 |
sub act {123}; |
| 44 |
|
| 45 |
Test::More::is( $value, '123', 'Rodland regression test' ); |
| 46 |
|
| 47 |
# vim: expandtab shiftwidth=4: |