3 test_description="Test the svn importer's input handling routines.
5 These tests provide some simple checks that the line_buffer API
8 While at it, check that input of newlines and null bytes are handled
13 test_expect_success 'hello world' '
14 echo ">HELLO" >expect &&
15 test-line-buffer <<-\EOF >actual &&
19 test_cmp expect actual
22 test_expect_success '0-length read, send along greeting' '
23 echo ">HELLO" >expect &&
24 test-line-buffer <<-\EOF >actual &&
29 test_cmp expect actual
32 test_expect_success 'read from file descriptor' '
37 test-line-buffer "&4" 4<input >actual &&
38 test_cmp expect actual
41 test_expect_success 'skip, copy null byte' '
42 echo Q | q_to_nul >expect &&
43 q_to_nul <<-\EOF | test-line-buffer >actual &&
49 test_cmp expect actual
52 test_expect_success 'read null byte' '
53 echo ">QhelloQ" | q_to_nul >expect &&
54 q_to_nul <<-\EOF | test-line-buffer >actual &&
58 test_cmp expect actual
61 test_expect_success 'long reads are truncated' '
62 echo ">foo" >expect &&
63 test-line-buffer <<-\EOF >actual &&
67 test_cmp expect actual
70 test_expect_success 'long copies are truncated' '
71 printf "%s\n" ">" foo >expect &&
72 test-line-buffer <<-\EOF >actual &&
78 test_cmp expect actual
81 test_expect_success 'long binary reads are truncated' '
82 echo ">foo" >expect &&
83 test-line-buffer <<-\EOF >actual &&
87 test_cmp expect actual