X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=t%2Ft0081-line-buffer.sh;h=5067d1e15b566721c1a3ae79052cbcb023a03656;hb=bc67ad8c375ce8f31021411f088a968f12cb2675;hp=550fad0823a8d27cf1d49b1c55154ea7ce69de02;hpb=e2bbfed10da1753751a1562585d07dc23438449a;p=git.git diff --git a/t/t0081-line-buffer.sh b/t/t0081-line-buffer.sh index 550fad082..5067d1e15 100755 --- a/t/t0081-line-buffer.sh +++ b/t/t0081-line-buffer.sh @@ -47,13 +47,13 @@ long_read_test () { rm -f input && mkfifo input && { - { + ( generate_tens_of_lines $tens_of_lines "$line" && - sleep 100 - } >input & + exec sleep 100 + ) >input & } && test-line-buffer input <<-EOF >output && - read $readsize + binary $readsize copy $copysize EOF kill $! && @@ -71,23 +71,23 @@ test_expect_success 'setup: have pipes?' ' ' test_expect_success 'hello world' ' - echo HELLO >expect && + echo ">HELLO" >expect && test-line-buffer <<-\EOF >actual && - read 6 + binary 6 HELLO EOF test_cmp expect actual ' test_expect_success PIPE '0-length read, no input available' ' - >expect && + printf ">" >expect && rm -f input && mkfifo input && { sleep 100 >input & } && test-line-buffer input <<-\EOF >actual && - read 0 + binary 0 copy 0 EOF kill $! && @@ -95,9 +95,9 @@ test_expect_success PIPE '0-length read, no input available' ' ' test_expect_success '0-length read, send along greeting' ' - echo HELLO >expect && + echo ">HELLO" >expect && test-line-buffer <<-\EOF >actual && - read 0 + binary 0 copy 6 HELLO EOF @@ -105,18 +105,18 @@ test_expect_success '0-length read, send along greeting' ' ' test_expect_success PIPE '1-byte read, no input available' ' - printf "%s" ab >expect && + printf ">%s" ab >expect && rm -f input && mkfifo input && { - { + ( printf "%s" a && printf "%s" b && - sleep 100 - } >input & + exec sleep 100 + ) >input & } && test-line-buffer input <<-\EOF >actual && - read 1 + binary 1 copy 1 EOF kill $! && @@ -140,15 +140,6 @@ test_expect_success 'read from file descriptor' ' test_cmp expect actual ' -test_expect_success 'buffer_read_string copes with null byte' ' - >expect && - q_to_nul <<-\EOF | test-line-buffer >actual && - read 2 - Q - EOF - test_cmp expect actual -' - test_expect_success 'skip, copy null byte' ' echo Q | q_to_nul >expect && q_to_nul <<-\EOF | test-line-buffer >actual && @@ -170,18 +161,18 @@ test_expect_success 'read null byte' ' ' test_expect_success 'long reads are truncated' ' - echo foo >expect && + echo ">foo" >expect && test-line-buffer <<-\EOF >actual && - read 5 + binary 5 foo EOF test_cmp expect actual ' test_expect_success 'long copies are truncated' ' - printf "%s\n" "" foo >expect && + printf "%s\n" ">" foo >expect && test-line-buffer <<-\EOF >actual && - read 1 + binary 1 copy 5 foo