| 1 |
#!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 |
use 5.010001; |
| 18 |
use warnings; |
| 19 |
use strict; |
| 20 |
use English qw( -no_match_vars ); |
| 21 |
|
| 22 |
use Test::More tests => 4; |
| 23 |
|
| 24 |
if (not eval { require Marpa::R2; 1; }) { |
| 25 |
Test::More::diag($EVAL_ERROR); |
| 26 |
Test::More::BAIL_OUT('Could not load Marpa::R2'); |
| 27 |
} |
| 28 |
|
| 29 |
my $marpa_version_ok = defined $Marpa::R2::VERSION; |
| 30 |
my $marpa_version_desc = |
| 31 |
$marpa_version_ok |
| 32 |
? 'Marpa::R2 version is ' . $Marpa::R2::VERSION |
| 33 |
: 'No Marpa::R2::VERSION'; |
| 34 |
Test::More::ok( $marpa_version_ok, $marpa_version_desc ); |
| 35 |
|
| 36 |
my $marpa_string_version_ok = defined $Marpa::R2::STRING_VERSION; |
| 37 |
my $marpa_string_version_desc = "Marpa::R2 version is " . $Marpa::R2::STRING_VERSION |
| 38 |
// 'No Marpa::R2::STRING_VERSION'; |
| 39 |
Test::More::ok( $marpa_string_version_ok, $marpa_string_version_desc ); |
| 40 |
|
| 41 |
my @libmarpa_version = Marpa::R2::Thin::version(); |
| 42 |
my $libmarpa_version_ok = scalar @libmarpa_version; |
| 43 |
my $libmarpa_version_desc = |
| 44 |
$libmarpa_version_ok |
| 45 |
? ( "Libmarpa version is " . join q{.}, @libmarpa_version ) |
| 46 |
: "No Libmarpa version"; |
| 47 |
Test::More::ok( $libmarpa_version_ok, $libmarpa_version_desc ); |
| 48 |
|
| 49 |
Test::More::diag($marpa_string_version_desc); |
| 50 |
Test::More::diag($libmarpa_version_desc); |
| 51 |
Test::More::diag('Libmarpa tag: ' . Marpa::R2::Thin::tag()); |
| 52 |
|
| 53 |
my $grammar; |
| 54 |
my $eval_ok = eval { $grammar = Marpa::R2::Thin::G->new( { if => 1 } ); 1 }; |
| 55 |
Test::More::diag($EVAL_ERROR) if not $eval_ok; |
| 56 |
Test::More::ok( ($eval_ok && $grammar), 'Thin grammar created' ) |
| 57 |
or Test::More::BAIL_OUT('Could not create Marpa grammar'); |
| 58 |
|
| 59 |
# vim: expandtab shiftwidth=4: |