a string can be either quoted (single or doublequoted), then the text between this quotes is returned, quotes are escaped by doubling themself, no chopping at either end is done, or not quoted then the the tabs and spaces are chopped from the value at either end.
129 lines
2.3 KiB
Text
129 lines
2.3 KiB
Text
TESTING "test configuration system" ./test-config
|
|
|
|
TEST "initializing config system" init <<END
|
|
out: initialized
|
|
out: destroyed
|
|
END
|
|
|
|
|
|
PLANNED "loading configfile, simple" <<END
|
|
END
|
|
|
|
|
|
PLANNED "loading configfile, with includes" <<END
|
|
END
|
|
|
|
|
|
PLANNED "env var override" <<END
|
|
END
|
|
|
|
|
|
PLANNED "lowlevel get" <<END
|
|
END
|
|
|
|
|
|
PLANNED "lowlevel set" <<END
|
|
END
|
|
|
|
|
|
PLANNED "saving simple configfile" <<END
|
|
END
|
|
|
|
|
|
PLANNED "complex saving user file" <<END
|
|
END
|
|
|
|
|
|
TEST "number get, default" number_get test.number.1 '1234567890 # comment' <<END
|
|
out: 1234567890
|
|
END
|
|
|
|
export LUMIERA_TEST_NUMBER_1=987654321
|
|
|
|
TEST "number get, env override" number_get test.number.1 '1234567890 # comment' <<END
|
|
out: 987654321
|
|
END
|
|
|
|
export LUMIERA_TEST_NUMBER_1=barf
|
|
TEST "number get, type error" number_get_nodefault test.number.1 <<END
|
|
out: LUMIERA_ERROR_CONFIG_SYNTAX_VALUE:syntax error in value
|
|
END
|
|
|
|
LUMIERA_TEST_NUMBER_1=NAN
|
|
TEST "number get, env override, default fallback" number_get test.number.1 '1234567890 # comment' <<END
|
|
out: LUMIERA_ERROR_CONFIG_SYNTAX_VALUE:syntax error in value, 1234567890
|
|
END
|
|
|
|
unset LUMIERA_TEST_NUMBER_1
|
|
|
|
|
|
TEST "number get, syntax error" number_get_nodefault test.NUMBER.1 <<END
|
|
out: LUMIERA_ERROR_CONFIG_SYNTAX_KEY:syntax error in key
|
|
END
|
|
|
|
|
|
TEST "number get, no default, no env" number_get_nodefault test.number.1 <<END
|
|
out: LUMIERA_ERROR_CONFIG_NO_ENTRY:no configuration entry
|
|
END
|
|
|
|
|
|
PLANNED "number set" <<END
|
|
END
|
|
|
|
|
|
PLANNED "real get" <<END
|
|
END
|
|
|
|
|
|
PLANNED "real set" <<END
|
|
END
|
|
|
|
|
|
export LUMIERA_TEST_STRING="teststring"
|
|
|
|
TEST "string get" string_get test.string default <<END
|
|
out: 'teststring'
|
|
END
|
|
|
|
|
|
TEST "string get, default" string_get test.doesntexist default <<END
|
|
out: 'default'
|
|
END
|
|
|
|
LUMIERA_TEST_STRING=' no leading and trailing blanks '
|
|
TEST "string get, chopped" string_get test.string default <<END
|
|
out: 'no leading and trailing blanks'
|
|
END
|
|
|
|
|
|
LUMIERA_TEST_STRING=' " quoted string with spaces " "ignored" #comment'
|
|
TEST "string get, quoted" string_get test.string default <<END
|
|
out: ' quoted string with spaces '
|
|
END
|
|
|
|
|
|
LUMIERA_TEST_STRING=' "quoted string "" not ignored" #comment'
|
|
TEST "string get, quoted, escaped" string_get test.string default <<END
|
|
out: 'quoted string " not ignored'
|
|
END
|
|
|
|
|
|
PLANNED "string set" <<END
|
|
END
|
|
|
|
|
|
PLANNED "word get" <<END
|
|
END
|
|
|
|
|
|
PLANNED "word set" <<END
|
|
END
|
|
|
|
|
|
PLANNED "bool get" <<END
|
|
END
|
|
|
|
|
|
PLANNED "bool set" <<END
|
|
END
|
|
|