Blame tests/field_whitespace_v1.sh

Packit 1422b7
# added 2015-03-12 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 "whitespace parser"
Packit 1422b7
# the "word" parser unfortunatly treats everything except
Packit 1422b7
# a SP as being in the word. So a HT inside a word is
Packit 1422b7
# permitted, which does not work well with what we
Packit 1422b7
# want to test here. to solve this problem, we use op-quoted-string.
Packit 1422b7
# However, we must actually quote the samples with HT, because
Packit 1422b7
# that parser also treats HT as being part of the word. But thanks
Packit 1422b7
# to the quotes, we can force it to not do that.
Packit 1422b7
# rgerhards, 2015-04-30
Packit 1422b7
add_rule 'rule=:%a:op-quoted-string%%-:whitespace%%b:op-quoted-string%'
Packit 1422b7
Packit 1422b7
execute 'word1  word2' # multiple spaces
Packit 1422b7
assert_output_json_eq '{ "b": "word2", "a": "word1" }'
Packit 1422b7
execute 'word1 word2' # single space
Packit 1422b7
assert_output_json_eq '{ "b": "word2", "a": "word1" }'
Packit 1422b7
execute '"word1"	"word2"' # tab (US-ASCII HT)
Packit 1422b7
assert_output_json_eq '{ "b": "word2", "a": "word1" }'
Packit 1422b7
execute '"word1"	   	"word2"' # mix of tab and spaces
Packit 1422b7
assert_output_json_eq '{ "b": "word2", "a": "word1" }'
Packit 1422b7
Packit 1422b7
Packit 1422b7
cleanup_tmp_files
Packit 1422b7