Christian Egli | fcffc98 | 2011-03-14 09:44:55 +0000 | [diff] [blame] | 1 | #!/usr/bin/perl |
| 2 | use warnings; |
| 3 | use strict; |
| 4 | use Cwd 'abs_path'; |
| 5 | $|++; |
| 6 | |
Christian Egli | 9553960 | 2016-10-06 17:26:42 +0200 | [diff] [blame] | 7 | # Test table resolving given a complicated LOUIS_TABLEPATH |
Christian Egli | fcffc98 | 2011-03-14 09:44:55 +0000 | [diff] [blame] | 8 | # |
| 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 Egli | 9553960 | 2016-10-06 17:26:42 +0200 | [diff] [blame] | 15 | |
| 16 | my $abs_top_srcdir = abs_path("$ENV{srcdir}/.."); |
| 17 | |
| 18 | my @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 Egli | fcffc98 | 2011-03-14 09:44:55 +0000 | [diff] [blame] | 28 | my @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 Egli | 4fc1ad6 | 2011-03-30 09:37:02 +0000 | [diff] [blame] | 34 | "$ENV{srcdir}/tables/loop.ctb", |
Christian Egli | fcffc98 | 2011-03-14 09:44:55 +0000 | [diff] [blame] | 35 | # a list of tables with a relative path |
Christian Egli | 4fc1ad6 | 2011-03-30 09:37:02 +0000 | [diff] [blame] | 36 | "$ENV{srcdir}/../tables/en-us-g2.ctb,en-us-g1.ctb", |
Christian Egli | fcffc98 | 2011-03-14 09:44:55 +0000 | [diff] [blame] | 37 | # a table with an absolute path |
Christian Egli | 4fc1ad6 | 2011-03-30 09:37:02 +0000 | [diff] [blame] | 38 | abs_path("$ENV{srcdir}/tables/loop.ctb"), |
Christian Egli | fcffc98 | 2011-03-14 09:44:55 +0000 | [diff] [blame] | 39 | # a list of tables with an absolute path |
Christian Egli | 1dd80c3 | 2012-04-17 08:13:59 +0000 | [diff] [blame] | 40 | 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 Egli | fcffc98 | 2011-03-14 09:44:55 +0000 | [diff] [blame] | 55 | ); |
| 56 | |
| 57 | # ensure existing tables are found |
| 58 | foreach my $table (@tables) { |
Christian Egli | 778fa80 | 2012-09-04 15:17:32 +0000 | [diff] [blame] | 59 | system("../tools/lou_checktable $table --quiet") == 0 or die; |
Christian Egli | fcffc98 | 2011-03-14 09:44:55 +0000 | [diff] [blame] | 60 | } |
| 61 | |
| 62 | # ensure a non-existing table is not found |
Christian Egli | 778fa80 | 2012-09-04 15:17:32 +0000 | [diff] [blame] | 63 | system("../tools/lou_checktable nonexistent.ctb 2> /dev/null") != 0 or die; |