File: 02check.t

package info (click to toggle)
libtex-encode-perl 1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 128 kB
  • ctags: 20
  • sloc: perl: 888; makefile: 2
file content (35 lines) | stat: -rw-r--r-- 1,011 bytes parent folder | download | duplicates (5)
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
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl Encode-LaTeX.t'

#########################

# change 'tests => 1' to 'tests => last_test_to_print';

use Test::More tests => 6;
use Encode;
BEGIN { use_ok('TeX::Encode') };

#########################

# Insert your test code below, the Test::More module is use()ed here so read
# its man page ( perldoc Test::More ) for help writing this test script.

my $chr = chr(0xfffd); # what character will never be supported by TeX?
my $str = "start ".$chr." end";

my $left = encode('latex', $str, Encode::FB_QUIET);

is( $left, "start ", "FB_QUIET" );
is( $str, $chr." end", "FB_QUIET" );

$str = "start ".$chr." end";
$left = encode('latex', $str, Encode::FB_DEFAULT);

is( $left, "start ? end", "FB_DEFAULT" );

$left = eval { encode('latex', $str, Encode::FB_CROAK) };

my $err = "Unsupported character code point 0x0036";
is( substr($@,0,length($err)), $err, "FB_CROAK" );

ok(1);