1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
#!/bin/sh
test_description='test string buffer routines'
. ./sharness.sh
test_sbuf() {
echo "$1" | ../helper/test-sbuf > actual &&
echo "$2" > expect &&
test_cmp expect actual
}
test_expect_success 'addstr' '
test_sbuf "addstr ABCDEFGHIJKLMNO
print
len
bufsiz
addstr P
print
len
bufsiz
" "ABCDEFGHIJKLMNO
15
16
ABCDEFGHIJKLMNOP
16
17"
'
test_expect_success 'prepend' '
test_sbuf "cpy bar
print
len
bufsiz
prepend foo
print
len
bufsiz
" "bar
3
4
foobar
6
10"
'
test_done
|