]> andersk Git - libyaml.git/blob - tests/run-test-suite/test/libyaml-emitter.t
fb8a6343937f4511d7e661f94054f503d6743888
[libyaml.git] / tests / run-test-suite / test / libyaml-emitter.t
1 #!/usr/bin/env bash
2
3 set -e
4
5 if [[ $# -gt 0 ]]; then
6   ids=("$@")
7 else
8   ids=(`find data | grep '/===$' | cut -d/ -f2 | sort`)
9 fi
10
11 # Some environments like on OS X, the shell resets the following vars, so we
12 # work around it like so:
13 export LD_LIBRARY_PATH="${MY_LD_LIBRARY_PATH:?}"
14 export DYLD_LIBRARY_PATH="${MY_LD_LIBRARY_PATH:?}"
15
16 count=0
17 for id in "${ids[@]}"; do
18   dir="data/$id"
19   label="$id: $(< $dir/===)"
20   [[ -e "$dir/in.yaml" ]] || continue
21   if grep "$id" test/libyaml-emitter.skip >/dev/null; then
22     echo "ok $((++count)) # SKIP $label"
23     continue
24   fi
25   want="$dir/out.yaml"
26   [[ -e $want ]] || want="$dir/in.yaml"
27   ./src/libyaml-emitter "$dir/test.event" > /tmp/test.out || {
28     (
29       cat "$dir/test.event"
30       cat "$want"
31     ) | sed 's/^/# /'
32   }
33   ok=true
34   output="$(${DIFF:-diff} -u $want /tmp/test.out)" || ok=false
35   if $ok; then
36     echo "ok $((++count)) $label"
37   else
38     echo "not ok $((++count)) $label"
39     echo "$output" | sed 's/^/# /'
40   fi
41 done
42
43 echo "1..$count"
This page took 0.026365 seconds and 3 git commands to generate.