1#!/bin/bash
2
3got=$(mktemp)
4
5count=0
6for test in test/*.events; do
7  want=${test//.events/.out}
8  label="Emitting '$test' equals '$want'"
9  rc=0
10  ./libyaml-emitter $test > $got || rc=$?
11  if [[ $rc -ne 0 ]]; then
12    echo "not ok $((++count)) - Error code $rc"
13    continue
14  fi
15  rc=0
16  diff=$(diff -u $want $got) || rc=$?
17  if [[ $rc -eq 0 ]]; then
18    echo "ok $((++count)) - $label"
19  else
20    echo "not ok $((++count)) - $label"
21    diff=${diff//$'\n'/$'\n'# }
22    echo "# $diff"
23  fi
24done
25
26echo "1..$count"
27