blob: ff5a8fda355b8607c1a849276a019b83e35d2920 [file] [log] [blame]
Christian Eglifcffc982011-03-14 09:44:55 +00001#!/usr/bin/perl
2use warnings;
3use strict;
4use Cwd 'abs_path';
5$|++;
6
Christian Egli95539602016-10-06 17:26:42 +02007# Test table resolving given a complicated LOUIS_TABLEPATH
Christian Eglifcffc982011-03-14 09:44:55 +00008#
9# Copyright (C) 2011 by Swiss Library for the Blind, Visually Impaired and Print Disabled
10#
11# Copying and distribution of this file, with or without modification,
12# are permitted in any medium without royalty provided the copyright
13# notice and this notice are preserved.
14
Christian Egli95539602016-10-06 17:26:42 +020015
16my $abs_top_srcdir = abs_path("$ENV{srcdir}/..");
17
18my @paths = (
19 "$abs_top_srcdir/tables",
20 "$abs_top_srcdir/tests/tables",
21 "$abs_top_srcdir/tests/tables/moreTables",
22 "$abs_top_srcdir/tests/tablesWithMetadata",
23 "$abs_top_srcdir/tests/tables/emphclass",
24 );
25
26$ENV{"LOUIS_TABLEPATH"} = join(",", @paths);
27
Christian Eglifcffc982011-03-14 09:44:55 +000028my @tables = (
29 # a global table
30 "en-us-g2.ctb",
31 # a local table
32 "loop.ctb",
33 # a table with a relative path
Christian Egli4fc1ad62011-03-30 09:37:02 +000034 "$ENV{srcdir}/tables/loop.ctb",
Christian Eglifcffc982011-03-14 09:44:55 +000035 # a list of tables with a relative path
Christian Egli4fc1ad62011-03-30 09:37:02 +000036 "$ENV{srcdir}/../tables/en-us-g2.ctb,en-us-g1.ctb",
Christian Eglifcffc982011-03-14 09:44:55 +000037 # a table with an absolute path
Christian Egli4fc1ad62011-03-30 09:37:02 +000038 abs_path("$ENV{srcdir}/tables/loop.ctb"),
Christian Eglifcffc982011-03-14 09:44:55 +000039 # a list of tables with an absolute path
Christian Egli1dd80c32012-04-17 08:13:59 +000040 abs_path("$ENV{srcdir}/../tables/en-us-g2.ctb") . ",en-us-g1.ctb",
41 # table combinations
42 # all global tables
43 "en-us-g2.ctb,braille-patterns.cti",
44 # a global and a local table
45 "braille-patterns.cti,pass2.ctb",
46 # a local and a global table
47 "pass2.ctb,braille-patterns.cti",
48 # a relative, a local and a global table
49 "$ENV{srcdir}/tables/loop.ctb,pass2.ctb,braille-patterns.cti",
50 # a table which includes local and global tables
51 "include.utb",
52 # a relative table and a table which includes local and global tables
53 # currently fails
54# "$ENV{srcdir}/tables/loop.ctb,include.utb",
Christian Eglifcffc982011-03-14 09:44:55 +000055 );
56
57# ensure existing tables are found
58foreach my $table (@tables) {
Christian Egli778fa802012-09-04 15:17:32 +000059 system("../tools/lou_checktable $table --quiet") == 0 or die;
Christian Eglifcffc982011-03-14 09:44:55 +000060}
61
62# ensure a non-existing table is not found
Christian Egli778fa802012-09-04 15:17:32 +000063system("../tools/lou_checktable nonexistent.ctb 2> /dev/null") != 0 or die;