xref: /freebsd/contrib/libucl/tests/basic.test (revision d8a0fe102c0cfdfcd5b818f850eff09d8536c9bc)
1#!/bin/sh
2
3PROG=${TEST_BINARY_DIR}/test_basic
4
5for _tin in ${TEST_DIR}/basic/*.in ; do
6	_t=`echo $_tin | sed -e 's/.in$//'`
7	_out=${TEST_OUT_DIR}/basic.out
8	$PROG $_t.in $_out
9	if [ $? -ne 0 ] ; then
10		echo "Test: $_t failed, output:"
11		cat $_out
12		rm $_out
13		exit 1
14	fi
15	if [ -f $_t.res ] ; then
16	diff -s $_out $_t.res -u 2>/dev/null
17		if [ $? -ne 0 ] ; then
18			rm $_out
19			echo "Test: $_t output missmatch"
20			exit 1
21		fi
22	fi
23	rm $_out
24	# Use FD interface
25	$PROG -f $_t.in > /dev/null
26	# JSON output
27	$PROG -j $_t.in > /dev/null
28	$PROG -c -j $_t.in > /dev/null
29	# YAML output
30	$PROG -y $_t.in > /dev/null
31	# Save comments mode
32	$PROG -C $_t.in > /dev/null
33	# Save macro mode
34	$PROG -M $_t.in > /dev/null
35	$PROG -M -C $_t.in > /dev/null
36done
37
38
39