#/bin/bash
# Test configuration parser.
. common.sh
set +o errexit

$HITCH --test --config=configs/default.cfg certs/default.example.com 2>/dev/null 1>&2
test "$?" = "0" || die "default.cfg is not testable."

$HITCH --test --config=configs/test08a.cfg certs/default.example.com 2>/dev/null 1>&2
test "$?" = "1" || die "Invalid config test08a.cfg parsed correctly."

$HITCH --test --config=configs/test08b.cfg certs/default.example.com 2>/dev/null
test "$?" = "1" || die "Invalid config test08b.cfg parsed correctly."

$HITCH --test --config=configs/test08c.cfg certs/default.example.com 2>/dev/null
test "$?" = "0" || die "Valid config test08c.cfg unparseable?"

$HITCH --test --config=configs/test08d.cfg certs/default.example.com 2>/dev/null 1>&2
test "$?" = "0" || die "Valid config test08d.cfg unparseable?"

# Issue #52.
$HITCH --config=configs/default.cfg --help 2>/dev/null 1>&2
test "$?" = "0" || die "--help after --config does not work as expected."

# Works as expected.
$HITCH --test --config=configs/default.cfg 2>/dev/null 1>&2
test "$?" = "1" || die "--help with --config does not work as expected."
