summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/uptexdir/wcfname.test
blob: c988e1f3e9fe8453f170c2c6c95b51df26823427 (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#! /bin/sh -vx
#
# Copyright 2022-2023 Japanese TeX Development Community <issue@texjp.org>
# You may freely use, modify and/or distribute this file.

test -d uptests || mkdir -p uptests
rm -f uptests/fn*.log uptests/fn*.txt uptests/fn*.tex fn*.tex

rc=0

TEXMFCNF=$srcdir/../kpathsea; export TEXMFCNF
TEXINPUTS=uptests:.; export TEXINPUTS

for loc in C.UTF-8 C.utf8 en_US.UTF-8 en_US.utf8 ja_JP.UTF-8 ja_JP.utf8; do
  locale -a | grep "^$loc\$"
  ret=$?
  if [ -f /etc/slackware-version ]; then
    loc=`echo $loc | sed -e "s/utf8/UTF-8/"`
  fi
  if [ $ret = 0 ]; then
    LC_ALL=$loc; LANGUAGE=$loc; export LC_ALL LANGUAGE
    break
  fi
done
if [ $ret != 0 ]; then
  # linux musl fails to run `locale -a` but seems to have C.UTF-8
  loc=C.UTF-8
  LC_ALL=$loc; LANGUAGE=$loc; export LC_ALL LANGUAGE
fi

perl $srcdir/tests/fn-generate.perl uptests
pret=$?
if [ $pret != 0 ] && [ $pret != 239 ]; then
  exit 128
fi

# upTeX internal encoding
fenc="utf8"
for ienc in euc sjis uptex; do
for doc in fn-$fenc fnさざ波-$fenc fn£¥µÆÇñß-$fenc; do

  if [ $ienc != uptex -a $doc = fn£¥µÆÇñß-$fenc ]; then
    continue
  fi

  if [ "$COMSPEC" != "" ]; then
    echo "*** We guess OS is Windows."
    if [ $ienc = uptex ]; then
      command_line_encoding=utf8
      export command_line_encoding
    else
      command_line_encoding=none
      export command_line_encoding
    fi
  fi

  echo '>>> Document:'$doc '  File Encoding:'$fenc '  Internal Encoding:'$ienc
  ./uptex -ini -interaction nonstopmode -jobname=$doc-$ienc -kanji=$fenc --kanji-internal=$ienc --shell-escape $doc.tex >uptests/$doc-$ienc-term.log || rc=1
  mv $doc-$ienc.txt $doc-$ienc.log uptests/
  diff uptests/$doc-$ienc.txt $srcdir/tests/fn-$fenc.txt || rc=2

done
done

if [ $pret = 239 ]; then
  echo "*** skip tests for Shift_JIS & EUC-JP."
  exit 0
fi


# pTeX compatible mode, regacy encoding
for fenc in sjis euc; do
for doc in fnさざ波-$fenc; do

  ienc=$fenc
  if [ "$COMSPEC" != "" ]; then
    echo "*** We guess OS is Windows."
    if [ $fenc != euc ]; then ienc="sjis"; fi
    if [ $ienc = uptex ]; then
      command_line_encoding=utf8
      export command_line_encoding
    else
      command_line_encoding=none
      export command_line_encoding
    fi
  else
    echo "*** We guess OS is not Windows."
    if [ $fenc != sjis ]; then ienc="euc"; fi
  fi
  if [ $ienc != uptex ]; then
    guess_input_kanji_encoding=1
    export guess_input_kanji_encoding
  fi

  echo '>>> Document:'$doc '  File Encoding:'$fenc '  Internal Encoding:'$ienc
  ./uptex -ini -interaction nonstopmode -jobname=$doc-$ienc -kanji=$fenc --kanji-internal=$ienc --shell-escape $doc.tex >uptests/$doc-$fenc-term.log || rc=3
  mv $doc-$ienc.txt $doc-$ienc.log uptests/
  diff uptests/$doc-$ienc.txt $srcdir/tests/fn-$fenc.txt || rc=4

done
done


exit $rc