TESTING "test configuration system" ./test-configloader

TEST "initialising config system" init <<END
out: initialised
out: destroyed
END


TEST "create configitem with empty line" configitem_simple '' <<END
out: line = ''
END

# fails due libtool problems with empty strings 
PLANNED "create configitem with blank line" configitem_simple '    ' <<END
out: line = '    '
END

TEST "create configitem simple entry" configitem_simple 'foo.bar = baz' <<END
out: line = 'foo.bar = baz'
out: key = 'foo.bar'
out: delim = '='
out: value = ' baz'
END

TEST "reset a value" change_value foo.bar '=foo' '=bar' <<END
out: foo
out: bar
END

TEST "create configitem with empty line" configitem_simple_ctor_dtor '' <<END
END

TEST "create configitem with blank line" configitem_simple_ctor_dtor $' \t \t' <<END
END

TEST "create configitem with comment" configitem_simple_ctor_dtor $' #\t comment bla' <<END
END

TEST "create configitem with section" configitem_simple_ctor_dtor $'\t[prefix suffix ] bla' <<END
END

TEST "create configitem with directive" configitem_simple_ctor_dtor $' @include \t\t file   \t' <<END
END

TEST "create configitem with configentry" configitem_simple_ctor_dtor $' key \t=\t value' <<END
END

TEST "create configitem with configentry (redirect)" configitem_simple_ctor_dtor $'keya <\t\t keyb ' <<END
END

TEST "check content of configitem with empty line" configitem_simple_content_check $'' << END
END

TEST "check content of configitem with comment" configitem_simple_content_check $' #comment bla' << END
out: item->line = ' #comment bla'
END

TEST "check content of configitem with section" configitem_simple_content_check $'[ key.foo suffix.bar ] ' << END
out: item->line = '\[ key\.foo suffix.bar \] '
out: item->key_size = '7'
out: item->key = 'key.foo suffix.bar \] '
out: item->delim = ' suffix.bar \] '
END

TEST "check content of configitem with directive (without argument)" configitem_simple_content_check $' @directive' << END
out: item->line = ' @directive'
out: item->key_size = '9'
out: item->key = '@directive'
END

TEST "check content of configitem with directive (with argument)" configitem_simple_content_check $' @directive argument' << END
out: item->line = ' @directive argument'
out: item->key_size = '9'
out: item->key = '@directive argument'
out: item->delim = ' argument'
END

TEST "check content of configitem with configentry" configitem_simple_content_check $'key.foo =bar' << END
out: item->line = 'key.foo =bar'
out: item->key_size = '7'
out: item->key = 'key.foo =bar'
out: item->delim = '=bar'
END

TEST "check content of configitem with configentry (redirect)" configitem_simple_content_check $'key.foo <key.bar' << END
out: item->line = 'key.foo <key.bar'
out: item->key_size = '7'
out: item->key = 'key.foo <key.bar'
out: item->delim = '<key.bar'
END


TEST "set a config and retrieve it" basic_set_get 'foo' '=bar' <<END
out: bar
END


TEST "key lookup" lookup <<END
END

