tests: give vcs-svn/line_buffer its own test script
[git/mingw/4msysgit.git] / t / t0081-line-buffer.sh
blob13ac735b550777447c2969e56b9973306aad434c
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 5
11 HELLO
12 EOF
13 test_cmp expect actual
16 test_expect_success '0-length read, send along greeting' '
17 printf "%s\n" "" HELLO >expect &&
18 test-line-buffer <<-\EOF >actual &&
19 read 0
21 copy 5
22 HELLO
23 EOF
24 test_cmp expect actual
27 test_expect_success 'buffer_read_string copes with trailing null byte' '
28 echo >expect &&
29 q_to_nul <<-\EOF | test-line-buffer >actual &&
30 read 1
32 EOF
33 test_cmp expect actual
36 test_expect_success '0-length read, copy null byte' '
37 printf "%s\n" "" Q | q_to_nul >expect &&
38 q_to_nul <<-\EOF | test-line-buffer >actual &&
39 read 0
41 copy 1
43 EOF
44 test_cmp expect actual
47 test_expect_success 'long reads are truncated' '
48 printf "%s\n" foo "" >expect &&
49 test-line-buffer <<-\EOF >actual &&
50 read 5
51 foo
52 EOF
53 test_cmp expect actual
56 test_expect_success 'long copies are truncated' '
57 printf "%s\n" "" foo >expect &&
58 test-line-buffer <<-\EOF >actual &&
59 read 0
61 copy 5
62 foo
63 EOF
64 test_cmp expect actual
67 test_done