about summary refs log tree commit diff
path: root/t/0.t
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2017-12-13 20:08:16 +0100
committerLeah Neukirchen <leah@vuxu.org>2017-12-13 20:08:16 +0100
commitfe97a9451e6e9f08f893c27dac1cf16a9f75eaa9 (patch)
treeb990aed07b8dc37131ad5ba8f88c63bf6ca55826 /t/0.t
parentd25bfe3cfb6b798b388c0f8bd865377ed2f14b56 (diff)
downloadrnl-fe97a9451e6e9f08f893c27dac1cf16a9f75eaa9.tar.gz
rnl-fe97a9451e6e9f08f893c27dac1cf16a9f75eaa9.tar.xz
rnl-fe97a9451e6e9f08f893c27dac1cf16a9f75eaa9.zip
add tests
Diffstat (limited to 't/0.t')
-rwxr-xr-xt/0.t63
1 files changed, 63 insertions, 0 deletions
diff --git a/t/0.t b/t/0.t
new file mode 100755
index 0000000..c6e999c
--- /dev/null
+++ b/t/0.t
@@ -0,0 +1,63 @@
+#!/bin/sh
+
+export "PATH=.:$PATH"
+
+printf '1..11\n'
+printf '# error handling\n'
+
+tap3 '-0 on a pipe, no newlines' <<'EOF'
+printf foo | rnl -0 | wc -c
+>>>/3/
+EOF
+
+tap3 '-0 on a pipe, one newline' <<'EOF'
+printf 'foo\n' | rnl -0 | wc -c
+>>>/3/
+EOF
+
+tap3 '-0 on a pipe, two newlines' <<'EOF'
+printf 'foo\nbar\n\n' | rnl -0 | wc -c
+>>>/7/
+EOF
+
+tap3 '-0 on a pipe, three newlines' <<'EOF'
+printf 'foo\n\nbar\n\n\n' | rnl -0 | wc -c
+>>>/8/
+EOF
+
+tap3 '-0 on a pipe, 9999 newlines' <<'EOF'
+( printf 'foo'; yes '' | sed 10000q ) | rnl -0 | wc -c
+>>>/3/
+EOF
+
+
+
+tap3 '-0 on a file, no newlines' <<'EOF'
+printf foo > TMP; rnl -0 TMP; wc -c <TMP; rm TMP
+>>>/3/
+EOF
+
+tap3 '-0 on a file, one newline' <<'EOF'
+printf 'foo\n' > TMP; rnl -0 TMP; wc -c <TMP; rm TMP
+>>>/3/
+EOF
+
+tap3 '-0 on a file, two newlines' <<'EOF'
+printf 'foo\nbar\n\n' > TMP; rnl -0 TMP; wc -c <TMP; rm TMP
+>>>/7/
+EOF
+
+tap3 '-0 on a file, three newlines' <<'EOF'
+printf 'foo\n\nbar\n\n\n' > TMP; rnl -0 TMP; wc -c <TMP; rm TMP
+>>>/8/
+EOF
+
+tap3 '-0 on a file, 9999 newlines' <<'EOF'
+( printf 'foo'; yes '' | sed 10000q ) > TMP; rnl -0 TMP; wc -c <TMP; rm TMP
+>>>/3/
+EOF
+
+tap3 '-0 on a biggish file, 9999 newlines' <<'EOF'
+( yes 'foo' | sed 10000q; yes '' | sed 10000q ) > TMP; rnl -0 TMP; wc -c <TMP; rm TMP
+>>>/39999/
+EOF