2019-05-03 20:50:19 +00:00
#!/usr/bin/env bash
2019-08-07 16:46:19 +00:00
export HOME = "./test-config"
rm -rf ./test-config
mkdir -p $HOME /.config
2021-05-20 05:05:21 +00:00
run_test ${ lnav_test } -nN \
-c ":config /global/foo bar"
check_output "config write global var" <<EOF
EOF
run_test ${ lnav_test } -nN \
-c ":config /global/foo"
check_output "config read global var" <<EOF
/global/foo = "foo"
EOF
2019-05-03 20:50:19 +00:00
run_test ${ lnav_test } -n \
-c ":config /ui/theme-defs/default/styles/text/color #f" \
${ test_dir } /logfile_access_log.0
check_error_output "config bad color" <<EOF
error:command-option:1:Could not parse color: #f
EOF
2021-02-01 06:43:19 +00:00
run_test env TMPDIR = tmp ${ lnav_test } -n \
-c ':config /tuning/archive-manager/min-free-space abc' \
${ srcdir } /logfile_syslog.0
check_error_output "invalid min-free-space allowed?" <<EOF
command-option:1: error: expecting an integer, found: abc
EOF
2019-05-03 20:50:19 +00:00
run_test ${ lnav_test } -n \
-c ":config /ui/theme baddy" \
${ test_dir } /logfile_access_log.0
check_error_output "config bad theme" <<EOF
error:command-option:1:unknown theme -- baddy
EOF
run_test ${ lnav_test } -n \
-I ${ test_dir } /bad-config2 \
${ test_dir } /logfile_access_log.0
check_error_output "config bad theme" <<EOF
2021-05-26 05:27:09 +00:00
warning:{ test_dir} /bad-config2/formats/invalid-config/config.malformed.json:line 2
2019-05-04 14:07:39 +00:00
warning: unexpected path --
warning: /ui
warning: accepted paths --
2020-05-07 14:08:59 +00:00
warning: \$ schema The URI of the schema for this file -- Specifies the type of this file
2021-01-17 06:23:20 +00:00
warning: tuning -- Internal settings
2020-05-07 14:08:59 +00:00
warning: ui -- User-interface settings
warning: global -- Global variable definitions
2021-05-26 05:27:09 +00:00
warning:{ test_dir} /bad-config2/formats/invalid-config/config.truncated.json:line 2
2019-05-04 14:07:39 +00:00
warning: unexpected path --
warning: /ui
warning: accepted paths --
2020-05-07 14:08:59 +00:00
warning: \$ schema The URI of the schema for this file -- Specifies the type of this file
2021-01-17 06:23:20 +00:00
warning: tuning -- Internal settings
2020-05-07 14:08:59 +00:00
warning: ui -- User-interface settings
warning: global -- Global variable definitions
2021-05-26 05:27:09 +00:00
error:{ test_dir} /bad-config2/formats/invalid-config/config.malformed.json:3:invalid json -- parse error: object key and value must be separated by a colon ( ':' )
2019-05-04 14:07:39 +00:00
"ui" : "theme" , "abc" , "def" : "" }
( right here) ------^
2021-05-26 05:27:09 +00:00
error:{ test_dir} /bad-config2/formats/invalid-config/config.truncated.json: invalid json -- parse error: premature EOF
2019-05-03 20:50:19 +00:00
EOF