summaryrefslogtreecommitdiff
path: root/Build/source/texk/mendexk/tests/encode.test
blob: 507a5b93882cfaf386f7e0cc9ce8ca5ba30db9d1 (plain)
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
#! /bin/sh -vx
# $Id$
# Copyright 2022-2024 Japanese TeX Development Community <issue@texjp.org>
# Copyright 2017-2022 Karl Berry <tex-live@tug.org>
# Copyright 2013 Peter Breitenlohner <tex-live@tug.org>
# You may freely use, modify and/or distribute this file.

BinDir=${BinDir:-.}
ExeExt=${ExeExt:-}
_mendex=$BinDir/mendex$ExeExt

TEXMFCNF=$srcdir/../kpathsea
export TEXMFCNF

rm -f sjis.* euc.* enc*.*
rc=0

# guess file encoding
cat $srcdir/tests/uni.idx | \
	guess_input_kanji_encoding=1 $_mendex -U -d $srcdir/tests/uni.dict -s $srcdir/tests/sjis.ist \
	>sjis.ind1 2>sjis.ilg1 \
	&& diff $srcdir/tests/uni.ind sjis.ind1 || rc=20

cat $srcdir/tests/uni.idx | \
	$_mendex -U -d $srcdir/tests/uni.dict -s $srcdir/tests/euc.ist --guess-input-enc \
	>euc.ind1 2>euc.ilg1 \
	&& diff $srcdir/tests/uni.ind euc.ind1 || rc=21

# input from file
for enc in j e s u; do
$_mendex --guess-input-enc -s $srcdir/tests/jis.ist -d $srcdir/tests/enc.dic $srcdir/tests/enc-$enc.idx \
	-o enc-$enc.ind1 -t enc-$enc.ilg \
	&& diff $srcdir/tests/enc-x.ind enc-$enc.ind1 || rc=101
done

for enc in j u; do
$_mendex --no-guess-input-enc -s $srcdir/tests/uni.ist -d $srcdir/tests/enc.dic $srcdir/tests/enc-$enc.idx \
	-o enc-$enc.ind1 -t enc-$enc.ilg \
	&& diff $srcdir/tests/enc-x.ind enc-$enc.ind1 || rc=102
done

# input from pipe
for enc in j u; do
cat $srcdir/tests/enc-$enc.idx | \
	$_mendex --guess-input-enc -i -s $srcdir/tests/euc.ist -d $srcdir/tests/enc.dic \
	-o enc-p-$enc.ind1 -t enc-p-$enc.ilg \
	&& diff $srcdir/tests/enc-x.ind enc-p-$enc.ind1 || rc=103
done

# imput from redirect
for enc in j u; do
$_mendex --guess-input-enc -i -s $srcdir/tests/sjis.ist -d $srcdir/tests/enc.dic < $srcdir/tests/enc-$enc.idx \
	-o enc-r-$enc.ind1 -t enc-r-$enc.ilg \
	&& diff $srcdir/tests/enc-x.ind enc-r-$enc.ind1 || rc=104
done


exit $rc