Debian Codegraph @

debian/tests/cli-smoke

raw symbols SCIP
1 #!/bin/sh
2 # Smoke-test the installed opencc CLI with the installed configurations.
3
4 set -eu
5
6 check() {
7 config="$1"
8 input="$2"
9 expected="$3"
10 actual="$(printf '%s\n' "$input" | opencc -c "$config")"
11 if [ "$actual" != "$expected" ]; then
12 echo "FAIL: $config: '$input' -> '$actual', expected '$expected'" >&2
13 exit 1
14 fi
15 echo "PASS: $config: '$input' -> '$actual'"
16 }
17
18 opencc --version
19
20 check s2t.json '汉字转换' '漢字轉換'
21 check t2s.json '漢字轉換' '汉字转换'
22 check s2twp.json '为什么你要学习编程?因为软件开发的信道很宽。' \
23 '為什麼你要學習程式設計?因為軟體開發的通道很寬。'
24 check s2hk.json '内地与香港' '內地與香港'