Browse Source

Paste bugfix, more tests.

Rob Landley 7 years ago
parent
commit
47d07dc155
2 changed files with 12 additions and 1 deletions
  1. 12 0
      tests/paste.test
  2. 0 1
      toys/posix/paste.c

+ 12 - 0
tests/paste.test

@@ -15,4 +15,16 @@ testing "" "paste -s three four" "\n\n" "" ""
 testing "" "paste three four" "" "" ""
 testing "" "paste - - -" "uno\tdos\tdesqview\nunix\t\t\n" "" "uno\ndos\ndesqview\nunix\n"
 testing "" "paste - - - -d ''" "unodosdesqview\nunix\n" "" "uno\ndos\ndesqview\nunix\n"
+testing "" "paste one two one two" \
+  "one1\ttwo1\tone1\ttwo1\none2\ttwo2\tone2\ttwo2\none3\ttwo3\tone3\ttwo3\n" \
+  "" ""
+testing "" "paste five three two" "five\t\ttwo1\n\t\ttwo2\n\t\ttwo3\n" "" ""
+testing "" "paste -d '私\0${UTFTEST}q' - - - - - - " \
+  "one私twothree${UTFTEST}fourqfive私six\n7私89${UTFTEST}q私\n" \
+  "" "one\ntwo\nthree\nfour\nfive\nsix\n7\n8\n9\n"
 rm -f one two three four
+unset UTFTEST
+
+# test -d \n
+# test -d \x
+# test 

+ 0 - 1
toys/posix/paste.c

@@ -83,7 +83,6 @@ static void paste_files(void)
               dpos++;
             }
           }
-          dpos++;
         } else {
           while (0<(dlen = mbtowc(&wc, dpos, 99))) {
             dpos += dlen;