aboutsummaryrefslogtreecommitdiff
path: root/testsuite/paste
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2025-11-10 12:48:38 +0000
committerRon Yorston <rmy@pobox.com>2025-11-10 12:52:02 +0000
commitaf09683cfc5ffe05f3e42bb592fe15a753540d85 (patch)
tree829a0801dd0d0603240dfcfe48e233f8600a06bf /testsuite/paste
parentf53dbcb8edbcfdad1721d0f5c9e8a16d54e983dc (diff)
downloadbusybox-w32-af09683cfc5ffe05f3e42bb592fe15a753540d85.tar.gz
busybox-w32-af09683cfc5ffe05f3e42bb592fe15a753540d85.tar.bz2
busybox-w32-af09683cfc5ffe05f3e42bb592fe15a753540d85.zip
paste: fix output when file lengths differ
If the files being pasted had different numbers of lines the output was incorrect. Rewrite the loop over all lines to allow for this. Add tests for such conditions. Adds 64-80 bytes. (GitHub issue #542)
Diffstat (limited to 'testsuite/paste')
-rw-r--r--testsuite/paste/paste-long-short19
-rw-r--r--testsuite/paste/paste-short-long19
2 files changed, 38 insertions, 0 deletions
diff --git a/testsuite/paste/paste-long-short b/testsuite/paste/paste-long-short
new file mode 100644
index 000000000..e626d730e
--- /dev/null
+++ b/testsuite/paste/paste-long-short
@@ -0,0 +1,19 @@
1cat > foo <<EOF
2foo1
3foo2
4foo3
5EOF
6
7cat > bar <<EOF
8bar1
9bar2
10EOF
11
12cat > baz <<EOF
13foo1 bar1
14foo2 bar2
15foo3
16EOF
17
18busybox paste foo bar > qux
19diff -u baz qux
diff --git a/testsuite/paste/paste-short-long b/testsuite/paste/paste-short-long
new file mode 100644
index 000000000..785da60a7
--- /dev/null
+++ b/testsuite/paste/paste-short-long
@@ -0,0 +1,19 @@
1cat > foo <<EOF
2foo1
3foo2
4EOF
5
6cat > bar <<EOF
7bar1
8bar2
9bar3
10EOF
11
12cat > baz <<EOF
13foo1 bar1
14foo2 bar2
15 bar3
16EOF
17
18busybox paste foo bar > qux
19diff -u baz qux