summaryrefslogtreecommitdiff
path: root/test/libyaml-parser.t
blob: 5e9cb9413d730339216ce52c7eece7c0502299cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env bash

# shellcheck disable=1090,2034

root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)

source "$root"/test/test-runner.bash

check-test() {
  id=$1
  t=data/$id

  grep "$id" "$root/blacklist/libyaml-parser" >/dev/null && return 1
  [[ -e $t/error ]] && return 1

  return 0
}

run-test() {
  dir=$1
  ok=true

  libyaml/tests/run-parser-test-suite "$dir/in.yaml" > /tmp/test.out || {
    (
      cat "$dir/in.yaml"
      cat "$dir/test.event"
    ) | sed 's/^/# /'
  }

  output=$(${DIFF:-diff} -u "$dir/test.event" /tmp/test.out) || ok=false
}

run-tests "$@"