File: multiple_table_path.pl

package info (click to toggle)
liblouis 3.36.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 86,248 kB
  • sloc: ansic: 37,162; makefile: 1,298; python: 772; lisp: 390; sh: 339; perl: 221; cpp: 21
file content (63 lines) | stat: -rwxr-xr-x 2,013 bytes parent folder | download | duplicates (18)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/perl
use warnings;
use strict;
use Cwd 'abs_path';
$|++;

# Test table resolving given a complicated LOUIS_TABLEPATH
#
# Copyright (C) 2011 by Swiss Library for the Blind, Visually Impaired and Print Disabled
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.


my $abs_top_srcdir = abs_path("$ENV{srcdir}/..");

my @paths = (
    "$abs_top_srcdir/tables",
    "$abs_top_srcdir/tests/tables",
    "$abs_top_srcdir/tests/tables/moreTables",
    "$abs_top_srcdir/tests/tablesWithMetadata",
    "$abs_top_srcdir/tests/tables/emphclass",
    );

$ENV{"LOUIS_TABLEPATH"} = join(",", @paths);

my @tables = (
    # a global table
    "en-us-g2.ctb",
    # a local table
    "loop.ctb",
    # a table with a relative path
    "$ENV{srcdir}/tables/loop.ctb",
    # a list of tables with a relative path
    "$ENV{srcdir}/../tables/en-us-g2.ctb,en-us-g1.ctb",
    # a table with an absolute path
    abs_path("$ENV{srcdir}/tables/loop.ctb"),
    # a list of tables with an absolute path
    abs_path("$ENV{srcdir}/../tables/en-us-g2.ctb") . ",en-us-g1.ctb",
    # table combinations
    # all global tables
    "en-us-g2.ctb,braille-patterns.cti",
    # a global and a local table
    "braille-patterns.cti,pass2.ctb",
    # a local and a global table
    "pass2.ctb,braille-patterns.cti",
    # a relative, a local and a global table
    "$ENV{srcdir}/tables/loop.ctb,pass2.ctb,braille-patterns.cti",
    # a table which includes local and global tables
    "include.utb",
    # a relative table and a table which includes local and global tables
    # currently fails
#    "$ENV{srcdir}/tables/loop.ctb,include.utb",
    );

# ensure existing tables are found
foreach my $table (@tables) {
    system("../tools/lou_checktable $table --quiet") == 0 or die;
}

# ensure a non-existing table is not found
system("../tools/lou_checktable nonexistent.ctb 2> /dev/null") != 0 or die;