diff options
author | Amitay Isaacs <amitay@gmail.com> | 2018-07-18 18:42:10 +1000 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2019-03-26 07:49:18 +0000 |
commit | 2c89c38851874637e1a7c92ce913427279b1cbe6 (patch) | |
tree | cccae34a00c5a65d94d2360f5a42e9835d0c9c28 /ctdb/tests/cunit | |
parent | 4a5868be3a9b15ed83731a31d42fbd3c5b11678a (diff) | |
download | samba-2c89c38851874637e1a7c92ce913427279b1cbe6.tar.gz |
ctdb-common: Add line based I/O
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
(cherry picked from commit c7041b0faf490661818244dd032ad413ce906e5c)
Diffstat (limited to 'ctdb/tests/cunit')
-rwxr-xr-x | ctdb/tests/cunit/line_test_001.sh | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/ctdb/tests/cunit/line_test_001.sh b/ctdb/tests/cunit/line_test_001.sh new file mode 100755 index 00000000000..991d01a24e7 --- /dev/null +++ b/ctdb/tests/cunit/line_test_001.sh @@ -0,0 +1,90 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +tfile="${TEST_VAR_DIR}/line.$$" + +remove_files () +{ + rm -f "$tfile" +} + +test_cleanup remove_files + +> "$tfile" + +ok_null +unit_test line_test "$tfile" + +printf "\0" > "$tfile" + +required_result 1 <<EOF + +EOF + +unit_test line_test "$tfile" + +echo -n "hello" > "$tfile" + +ok_null +unit_test line_test "$tfile" + +cat <<EOF > "$tfile" +hello +world +EOF + +required_result 2 << EOF +hello +world +EOF +unit_test line_test "$tfile" + +required_result 2 << EOF +hello +world +EOF +unit_test line_test "$tfile" + +cat <<EOF > "$tfile" +This is a really long long line full of random words and hopefully it will be read properly by the line test program and identified as a single line +EOF + +required_result 1 <<EOF +This is a really long long line full of random words and hopefully it will be read properly by the line test program and identified as a single line +EOF +unit_test line_test "$tfile" + +cat <<EOF > "$tfile" +line number one +line number two +line number one +line number two +line number one +EOF + +required_result 5 <<EOF +line number one +line number two +line number one +line number two +line number one +EOF +unit_test line_test "$tfile" 64 + +cat <<EOF > "$tfile" +this is line number one +this is line number two +this is line number three +this is line number four +this is line number five +EOF + +required_result 5 <<EOF +this is line number one +this is line number two +this is line number three +this is line number four +this is line number five +EOF +unit_test line_test "$tfile" 64 |