vcs-svn: tweak test-line-buffer to not assume line-oriented input
[git/jrn.git] / t / t0081-line-buffer.sh
blob68d616399548effd6285d26278eee29aa33f245d
1 #!/bin/sh
3 test_description="Test the svn importer's input handling routines.
5 . ./test-lib.sh
7 test_expect_success 'read greeting' '
8 echo HELLO >expect &&
9 test-line-buffer <<-\EOF >actual &&
10 read 6
11 HELLO
12 EOF
13 test_cmp expect actual
16 test_expect_success '0-length read, send along greeting' '
17 echo HELLO >expect &&
18 test-line-buffer <<-\EOF >actual &&
19 read 0
20 copy 6
21 HELLO
22 EOF
23 test_cmp expect actual
26 test_expect_success 'buffer_read_string copes with null byte' '
27 >expect &&
28 q_to_nul <<-\EOF | test-line-buffer >actual &&
29 read 2
31 EOF
32 test_cmp expect actual
35 test_expect_success 'skip, copy null byte' '
36 echo Q | q_to_nul >expect &&
37 q_to_nul <<-\EOF | test-line-buffer >actual &&
38 skip 2
40 copy 2
42 EOF
43 test_cmp expect actual
46 test_expect_success 'long reads are truncated' '
47 echo foo >expect &&
48 test-line-buffer <<-\EOF >actual &&
49 read 5
50 foo
51 EOF
52 test_cmp expect actual
55 test_expect_success 'long copies are truncated' '
56 printf "%s\n" "" foo >expect &&
57 test-line-buffer <<-\EOF >actual &&
58 read 1
60 copy 5
61 foo
62 EOF
63 test_cmp expect actual
66 test_done