Debian Codegraph @

texk/mendexk/tests/encode.test

raw
1 #! /bin/sh -vx
2 # $Id$
3 # Copyright 2022-2024 Japanese TeX Development Community <[email protected]>
4 # Copyright 2017-2022 Karl Berry <[email protected]>
5 # Copyright 2013 Peter Breitenlohner <[email protected]>
6 # You may freely use, modify and/or distribute this file.
7
8 BinDir=${BinDir:-.}
9 ExeExt=${ExeExt:-}
10 _mendex=$BinDir/mendex$ExeExt
11
12 TEXMFCNF=$srcdir/../kpathsea
13 export TEXMFCNF
14
15 rm -f sjis.* euc.* enc*.*
16 rc=0
17
18 # guess file encoding
19 cat $srcdir/tests/uni.idx | \
20 guess_input_kanji_encoding=1 $_mendex -U -d $srcdir/tests/uni.dict -s $srcdir/tests/sjis.ist \
21 >sjis.ind1 2>sjis.ilg1 \
22 && diff $srcdir/tests/uni.ind sjis.ind1 || rc=20
23
24 cat $srcdir/tests/uni.idx | \
25 $_mendex -U -d $srcdir/tests/uni.dict -s $srcdir/tests/euc.ist --guess-input-enc \
26 >euc.ind1 2>euc.ilg1 \
27 && diff $srcdir/tests/uni.ind euc.ind1 || rc=21
28
29 # input from file
30 for enc in j e s u; do
31 $_mendex --guess-input-enc -s $srcdir/tests/jis.ist -d $srcdir/tests/enc.dic $srcdir/tests/enc-$enc.idx \
32 -o enc-$enc.ind1 -t enc-$enc.ilg \
33 && diff $srcdir/tests/enc-x.ind enc-$enc.ind1 || rc=101
34 done
35
36 for enc in j u; do
37 $_mendex --no-guess-input-enc -s $srcdir/tests/uni.ist -d $srcdir/tests/enc.dic $srcdir/tests/enc-$enc.idx \
38 -o enc-$enc.ind1 -t enc-$enc.ilg \
39 && diff $srcdir/tests/enc-x.ind enc-$enc.ind1 || rc=102
40 done
41
42 # input from pipe
43 for enc in j u; do
44 cat $srcdir/tests/enc-$enc.idx | \
45 $_mendex --guess-input-enc -i -s $srcdir/tests/euc.ist -d $srcdir/tests/enc.dic \
46 -o enc-p-$enc.ind1 -t enc-p-$enc.ilg \
47 && diff $srcdir/tests/enc-x.ind enc-p-$enc.ind1 || rc=103
48 done
49
50 # imput from redirect
51 for enc in j u; do
52 $_mendex --guess-input-enc -i -s $srcdir/tests/sjis.ist -d $srcdir/tests/enc.dic < $srcdir/tests/enc-$enc.idx \
53 -o enc-r-$enc.ind1 -t enc-r-$enc.ilg \
54 && diff $srcdir/tests/enc-x.ind enc-r-$enc.ind1 || rc=104
55 done
56
57
58 exit $rc