1#!/usr/bin/perl -w
2
3# Copyright 2008, 2009, 2010, 2013, 2015 Kevin Ryde
4
5# This file is part of HTML-FormatExternal.
6#
7# HTML-FormatExternal is free software; you can redistribute it and/or
8# modify it under the terms of the GNU General Public License as published
9# by the Free Software Foundation; either version 3, or (at your option) any
10# later version.
11#
12# HTML-FormatExternal is distributed in the hope that it will be useful, but
13# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15# for more details.
16#
17# You should have received a copy of the GNU General Public License along
18# with HTML-FormatExternal.  If not, see <http://www.gnu.org/licenses/>.
19
20use strict;
21use warnings;
22use Test::More tests => 9;
23
24use lib 't';
25use MyTestHelpers;
26BEGIN { MyTestHelpers::nowarnings() }
27
28require HTML::FormatText::Links;
29{
30  my $want_version = 26;
31  is ($HTML::FormatText::Links::VERSION, $want_version,
32      'VERSION variable');
33  is (HTML::FormatText::Links->VERSION,  $want_version,
34      'VERSION class method');
35  ok (eval { HTML::FormatText::Links->VERSION($want_version); 1 },
36      "VERSION class check $want_version");
37  my $check_version = $want_version + 1000;
38  ok (! eval { HTML::FormatText::Links->VERSION($check_version); 1 },
39      "VERSION class check $check_version");
40
41  my $formatter = HTML::FormatText::Links->new;
42  is ($formatter->VERSION, $want_version, 'VERSION object method');
43  ok (eval { $formatter->VERSION($want_version); 1 },
44      "VERSION object check $want_version");
45  ok (! eval { $formatter->VERSION($check_version); 1 },
46      "VERSION object check $check_version");
47}
48
49## no critic (ProtectPrivateSubs)
50
51#-----------------------------------------------------------------------------
52# _links_mung_charset()
53
54foreach my $data (['latin-1', 'latin1'],
55                  ['LATIN-2', 'LATIN2'],
56                 ) {
57  my ($str, $want) = @$data;
58  is (HTML::FormatText::Links::_links_mung_charset($str),
59      $want,
60      "_links_mung_charset() '$str'");
61}
62
63exit 0;
64