xref: /freebsd/contrib/libucl/tests/basic.test (revision a0409676120c1e558d0ade943019934e0f15118d)
197bd480fSBaptiste Daroussin#!/bin/sh
297bd480fSBaptiste Daroussin
397bd480fSBaptiste DaroussinPROG=${TEST_BINARY_DIR}/test_basic
497bd480fSBaptiste Daroussin
597bd480fSBaptiste Daroussinfor _tin in ${TEST_DIR}/basic/*.in ; do
697bd480fSBaptiste Daroussin	_t=`echo $_tin | sed -e 's/.in$//'`
797bd480fSBaptiste Daroussin	_out=${TEST_OUT_DIR}/basic.out
897bd480fSBaptiste Daroussin	$PROG $_t.in $_out
997bd480fSBaptiste Daroussin	if [ $? -ne 0 ] ; then
1097bd480fSBaptiste Daroussin		echo "Test: $_t failed, output:"
1197bd480fSBaptiste Daroussin		cat $_out
1297bd480fSBaptiste Daroussin		rm $_out
1397bd480fSBaptiste Daroussin		exit 1
1497bd480fSBaptiste Daroussin	fi
1597bd480fSBaptiste Daroussin	if [ -f $_t.res ] ; then
1697bd480fSBaptiste Daroussin	diff -s $_out $_t.res -u 2>/dev/null
1797bd480fSBaptiste Daroussin		if [ $? -ne 0 ] ; then
1897bd480fSBaptiste Daroussin			rm $_out
19*a0409676SBaptiste Daroussin			echo "Test: $_t output mismatch"
2097bd480fSBaptiste Daroussin			exit 1
2197bd480fSBaptiste Daroussin		fi
2297bd480fSBaptiste Daroussin	fi
2397bd480fSBaptiste Daroussin	rm $_out
24d9f0ce31SBaptiste Daroussin	# Use FD interface
25d9f0ce31SBaptiste Daroussin	$PROG -f $_t.in > /dev/null
26d9f0ce31SBaptiste Daroussin	# JSON output
27d9f0ce31SBaptiste Daroussin	$PROG -j $_t.in > /dev/null
28d9f0ce31SBaptiste Daroussin	$PROG -c -j $_t.in > /dev/null
29d9f0ce31SBaptiste Daroussin	# YAML output
30d9f0ce31SBaptiste Daroussin	$PROG -y $_t.in > /dev/null
31d9f0ce31SBaptiste Daroussin	# Save comments mode
32d9f0ce31SBaptiste Daroussin	$PROG -C $_t.in > /dev/null
33d9f0ce31SBaptiste Daroussin	# Save macro mode
34d9f0ce31SBaptiste Daroussin	$PROG -M $_t.in > /dev/null
35d9f0ce31SBaptiste Daroussin	$PROG -M -C $_t.in > /dev/null
3697bd480fSBaptiste Daroussindone
3797bd480fSBaptiste Daroussin
3897bd480fSBaptiste Daroussin
39