diff options
| author | Ron Yorston <rmy@pobox.com> | 2025-11-10 12:48:38 +0000 |
|---|---|---|
| committer | Ron Yorston <rmy@pobox.com> | 2025-11-10 12:52:02 +0000 |
| commit | af09683cfc5ffe05f3e42bb592fe15a753540d85 (patch) | |
| tree | 829a0801dd0d0603240dfcfe48e233f8600a06bf /testsuite/paste | |
| parent | f53dbcb8edbcfdad1721d0f5c9e8a16d54e983dc (diff) | |
| download | busybox-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-short | 19 | ||||
| -rw-r--r-- | testsuite/paste/paste-short-long | 19 |
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 @@ | |||
| 1 | cat > foo <<EOF | ||
| 2 | foo1 | ||
| 3 | foo2 | ||
| 4 | foo3 | ||
| 5 | EOF | ||
| 6 | |||
| 7 | cat > bar <<EOF | ||
| 8 | bar1 | ||
| 9 | bar2 | ||
| 10 | EOF | ||
| 11 | |||
| 12 | cat > baz <<EOF | ||
| 13 | foo1 bar1 | ||
| 14 | foo2 bar2 | ||
| 15 | foo3 | ||
| 16 | EOF | ||
| 17 | |||
| 18 | busybox paste foo bar > qux | ||
| 19 | diff -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 @@ | |||
| 1 | cat > foo <<EOF | ||
| 2 | foo1 | ||
| 3 | foo2 | ||
| 4 | EOF | ||
| 5 | |||
| 6 | cat > bar <<EOF | ||
| 7 | bar1 | ||
| 8 | bar2 | ||
| 9 | bar3 | ||
| 10 | EOF | ||
| 11 | |||
| 12 | cat > baz <<EOF | ||
| 13 | foo1 bar1 | ||
| 14 | foo2 bar2 | ||
| 15 | bar3 | ||
| 16 | EOF | ||
| 17 | |||
| 18 | busybox paste foo bar > qux | ||
| 19 | diff -u baz qux | ||
