]>
Commit | Line | Data |
---|---|---|
a672b071 IN |
1 | #!/usr/bin/env bash |
2 | ||
3 | set -e | |
4 | ||
5 | if [[ $# -gt 0 ]]; then | |
6 | ids=("$@") | |
7 | else | |
c9878e19 | 8 | ids=($(cut -d: -f1 < test/libyaml-parser.list)) |
a672b071 IN |
9 | fi |
10 | ||
11 | count=0 | |
12 | for id in "${ids[@]}"; do | |
13 | dir="data/$id" | |
14 | label="$id: $(< $dir/===)" | |
15 | [[ -e "$dir/in.yaml" ]] || continue | |
a672b071 IN |
16 | ./src/libyaml-parser "$dir/in.yaml" > /tmp/test.out || { |
17 | ( | |
18 | cat "$dir/in.yaml" | |
19 | cat "$dir/test.event" | |
20 | ) | sed 's/^/# /' | |
21 | } | |
22 | ok=true | |
23 | output="$(${DIFF:-diff} -u $dir/test.event /tmp/test.out)" || ok=false | |
24 | if $ok; then | |
25 | echo "ok $((++count)) $label" | |
26 | else | |
27 | echo "not ok $((++count)) $label" | |
28 | echo "$output" | sed 's/^/# /' | |
29 | fi | |
30 | done | |
31 | ||
32 | echo "1..$count" |