cli history file long string test
This commit is contained in:
parent
b103599a1a
commit
e68a5ffa97
1 changed files with 31 additions and 10 deletions
|
|
@ -36,7 +36,7 @@ cat <<EOF > $histfile
|
|||
first line
|
||||
EOF
|
||||
|
||||
# NOTE Backend is not really use here
|
||||
# NOTE Backend is not really used here
|
||||
new "test params: -f $cfg"
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "kill old backend"
|
||||
|
|
@ -59,22 +59,22 @@ if [ ! -f $histfile ]; then
|
|||
err "$histfile" "not found"
|
||||
fi
|
||||
|
||||
new "Check it has two entries"
|
||||
lines=$(cat $histfile | wc -l)
|
||||
if [ $lines -ne 2 ]; then
|
||||
err "Line:$lines" "2"
|
||||
new "Check histfile has two entries"
|
||||
nr=$(cat $histfile | wc -l)
|
||||
if [ $nr -ne 2 ]; then
|
||||
err "2" "$nr"
|
||||
fi
|
||||
|
||||
new "check it contains first line"
|
||||
new "Check histfile contains first line"
|
||||
nr=$(grep -c "example 42" $histfile)
|
||||
if [ $nr -ne 1 ]; then
|
||||
err "Contains: example 42" "1"
|
||||
err "Contains: example 42" "$nr"
|
||||
fi
|
||||
|
||||
new "Check it contains example 42"
|
||||
new "Check histfile contains example 42"
|
||||
nr=$(grep -c "example 42" $histfile)
|
||||
if [ $nr -ne 1 ]; then
|
||||
err "Contains: example 42" "1"
|
||||
err "1" "$nr"
|
||||
fi
|
||||
|
||||
new "cli add entry and create newhist file"
|
||||
|
|
@ -88,7 +88,28 @@ fi
|
|||
new "check it contains example 43"
|
||||
nr=$(grep -c "example 43" $dir/newhist)
|
||||
if [ $nr -ne 1 ]; then
|
||||
err "Contains: example 43" "1"
|
||||
err "1" "$nr"
|
||||
fi
|
||||
|
||||
# Add a long (128 chars) string and see it survives
|
||||
str128="1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567"
|
||||
new "cli add long line"
|
||||
expecteof "$clixon_cli -f $cfg" 0 "$str128" "" 2> /dev/null # ignore error output
|
||||
|
||||
new "Check histfile contains long string"
|
||||
nr=$(grep -c "$str128" $histfile)
|
||||
if [ $nr -ne 1 ]; then
|
||||
err "1" "$nr"
|
||||
fi
|
||||
|
||||
new "cli load arrow-up save -> create two copies of long string"
|
||||
expecteof "$clixon_cli -f $cfg" 0 "q" ""
|
||||
expecteof "$clixon_cli -f $cfg" 0 "" "" 2> /dev/null
|
||||
|
||||
new "Check histfile contains two copies of long string"
|
||||
nr=$(grep -c "$str128" $histfile)
|
||||
if [ $nr -ne 2 ]; then
|
||||
err "2" "$nr"
|
||||
fi
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue