File: testemitter.test

package info (click to toggle)
libfyaml 0.9.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,328 kB
  • sloc: ansic: 62,193; asm: 8,692; sh: 1,628; makefile: 581; python: 23
file content (55 lines) | stat: -rwxr-xr-x 1,018 bytes parent folder | download
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env bash

EXTRA_DUMP_ARGS=""

if [ "x$1" == "x--streaming" ]; then
	EXTRA_DUMP_ARGS="$EXTRA_DUMP_ARGS --streaming"
elif  [ "x$1" == "x--restreaming" ]; then
	EXTRA_DUMP_ARGS="$EXTRA_DUMP_ARGS --streaming --recreating"
fi

count=0
for f in "${SRCDIR}"/emitter-examples/*.yaml; do
	count=`expr $count + 1`
done

# output plan
echo 1..$count

i=0
for f in "${SRCDIR}"/emitter-examples/*.yaml; do

	i=`expr $i + 1`
	tf=`basename $f`

	t1=`mktemp`
	t2=`mktemp`

	res="not ok"

	pass_parse=0
	${TOP_BUILDDIR}/src/fy-tool --testsuite --disable-flow-markers "$f" >"$t1"
	if [ $? -eq 0 ]; then
		${TOP_BUILDDIR}/src/fy-tool --dump ${EXTRA_DUMP_ARGS} "$f" | \
			${TOP_BUILDDIR}/src/fy-tool --testsuite --disable-flow-markers - >"$t2"
		if [ $? -eq 0 ]; then
			pass_parse=1
		fi
	fi

	# all errors test are expected to fail
	if [ "$pass_parse" == "1" ]; then
		diff -u "$t1" "$t2"
		if [ $? -eq 0 ]; then
			res="ok"
		else
			res="not ok"
		fi
	else
		res="not ok"
	fi

	rm -f "$t1" "$t2"

	echo "$res $i $tf"
done