Blame tests/field_string.sh

Packit 1422b7
# added 2015-09-02 by Rainer Gerhards
Packit 1422b7
# This file is part of the liblognorm project, released under ASL 2.0
Packit 1422b7
Packit 1422b7
uname -a | grep "SunOS.*5.10"
Packit 1422b7
if [ $? -eq 0 ] ; then
Packit 1422b7
   echo platform: `uname -a`
Packit 1422b7
   echo This looks like solaris 10, we disable known-failing tests to
Packit 1422b7
   echo permit OpenCSW to build packages. However, this are real failurs
Packit 1422b7
   echo and so a fix should be done as soon as time permits.
Packit 1422b7
   exit 77
Packit 1422b7
fi
Packit 1422b7
. $srcdir/exec.sh
Packit 1422b7
Packit 1422b7
test_def $0 "string syntax"
Packit 1422b7
Packit 1422b7
reset_rules
Packit 1422b7
add_rule 'version=2'
Packit 1422b7
add_rule 'rule=:a %f:string% b'
Packit 1422b7
Packit 1422b7
execute 'a test b'
Packit 1422b7
assert_output_json_eq '{"f": "test"}'
Packit 1422b7
Packit 1422b7
execute 'a "test" b'
Packit 1422b7
assert_output_json_eq '{"f": "test"}'
Packit 1422b7
Packit 1422b7
execute 'a "test with space" b'
Packit 1422b7
assert_output_json_eq '{"f": "test with space"}'
Packit 1422b7
Packit 1422b7
execute 'a "test with "" double escape" b'
Packit 1422b7
assert_output_json_eq '{ "f": "test with \" double escape" }'
Packit 1422b7
Packit 1422b7
execute 'a "test with \" backslash escape" b'
Packit 1422b7
assert_output_json_eq '{ "f": "test with \" backslash escape" }'
Packit 1422b7
Packit 1422b7
echo test quoting.mode
Packit 1422b7
reset_rules
Packit 1422b7
add_rule 'version=2'
Packit 1422b7
add_rule 'rule=:a %f:string{"quoting.mode":"none"}% b'
Packit 1422b7
Packit 1422b7
execute 'a test b'
Packit 1422b7
assert_output_json_eq '{"f": "test"}'
Packit 1422b7
Packit 1422b7
execute 'a "test" b'
Packit 1422b7
assert_output_json_eq '{"f": "\"test\""}'
Packit 1422b7
Packit 1422b7
echo "test quoting.char.*"
Packit 1422b7
reset_rules
Packit 1422b7
add_rule 'version=2'
Packit 1422b7
add_rule 'rule=:a %f:string{"quoting.char.begin":"[", "quoting.char.end":"]"}% b'
Packit 1422b7
Packit 1422b7
execute 'a test b'
Packit 1422b7
assert_output_json_eq '{"f": "test"}'
Packit 1422b7
Packit 1422b7
execute 'a [test] b'
Packit 1422b7
assert_output_json_eq '{"f": "test"}'
Packit 1422b7
Packit 1422b7
execute 'a [test test2] b'
Packit 1422b7
assert_output_json_eq '{"f": "test test2"}'
Packit 1422b7
Packit 1422b7
# things that need to NOT match
Packit 1422b7
Packit 1422b7
cleanup_tmp_files