| 1 |
#!/bin/bash |
| 2 |
set -e |
| 3 |
set -x |
| 4 |
|
| 5 |
function potool_test() |
| 6 |
{ |
| 7 |
local dir="$1" |
| 8 |
local desc="$2" |
| 9 |
local opts="$3" |
| 10 |
local out="$4" |
| 11 |
if [ -z "$out" ]; then out="in.po"; fi |
| 12 |
|
| 13 |
rm -f $dir/out.po |
| 14 |
echo TESTING $dir with "$desc" |
| 15 |
${WRAPPER} ../potool $opts $dir/in.po > $dir/out.po |
| 16 |
diff -u "$dir/$out" $dir/out.po |
| 17 |
rm -f $dir/out.po |
| 18 |
} |
| 19 |
|
| 20 |
potool_test 1 "no filter" "" |
| 21 |
(cd 1 && ls -1 | egrep -v '^(in.po|CVS)$') | while read out; do |
| 22 |
potool_test 1 "-${out/.po}" "-${out/.po}" "$out" |
| 23 |
done |
| 24 |
|
| 25 |
for dir in 2 |
| 26 |
do |
| 27 |
echo TESTING $dir/work.po |
| 28 |
${WRAPPER} ../potool $dir/in.po $dir/work.po > $dir/out.po |
| 29 |
diff -u $dir/work.po $dir/out.po |
| 30 |
rm -f $dir/out.po |
| 31 |
done |
| 32 |
|
| 33 |
function poedit_test() |
| 34 |
{ |
| 35 |
local dir="$1"; shift |
| 36 |
local desc="$1"; shift |
| 37 |
local opts="$1"; shift |
| 38 |
|
| 39 |
echo TESTING $dir with "$desc" |
| 40 |
cp $dir/in.po $dir/work.po |
| 41 |
PATH="$(pwd)/../scripts:$(pwd)/../:$PATH" EDITOR=: poedit $opts $dir/work.po |
| 42 |
diff -u $dir/in.po $dir/work.po |
| 43 |
rm -f $dir/work.po |
| 44 |
} |
| 45 |
|
| 46 |
poedit_test 3 "no options" "" |
| 47 |
poedit_test 3 "-a" "-a" |
| 48 |
|
| 49 |
poedit_test 4-wrapping "-p" "-p" |