tests: give vcs-svn/line_buffer its own test script
Split the line_buffer test into small pieces and move it to its own file as preparation for adding more tests. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Jonathan Nieder committed
Jan 2, 2011 at 18:51 UTC
232087fd99915abaa7d917fd181ad8477bb689f2
2 files changed
+67
-54
t/t0080-vcs-svn.sh
-54
@@ -76,60 +76,6 @@ test_expect_success 'obj pool: high-water mark' '
76
test_cmp expected actual
77
'
78
79
-test_expect_success 'line buffer' '
80
- echo HELLO >expected1 &&
81
- printf "%s\n" "" HELLO >expected2 &&
82
- echo >expected3 &&
83
- printf "%s\n" "" Q | q_to_nul >expected4 &&
84
- printf "%s\n" foo "" >expected5 &&
85
- printf "%s\n" "" foo >expected6 &&
86
-
87
- test-line-buffer <<-\EOF >actual1 &&
88
- read 5
89
- HELLO
90
- EOF
91
-
92
- test-line-buffer <<-\EOF >actual2 &&
93
- read 0
94
-
95
- copy 5
96
- HELLO
97
- EOF
98
-
99
- q_to_nul <<-\EOF |
100
- read 1
101
- Q
102
- EOF
103
- test-line-buffer >actual3 &&
104
-
105
- q_to_nul <<-\EOF |
106
- read 0
107
-
108
- copy 1
109
- Q
110
- EOF
111
- test-line-buffer >actual4 &&
112
-
113
- test-line-buffer <<-\EOF >actual5 &&
114
- read 5
115
- foo
116
- EOF
117
-
118
- test-line-buffer <<-\EOF >actual6 &&
119
- read 0
120
-
121
- copy 5
122
- foo
123
- EOF
124
-
125
- test_cmp expected1 actual1 &&
126
- test_cmp expected2 actual2 &&
127
- test_cmp expected3 actual3 &&
128
- test_cmp expected4 actual4 &&
129
- test_cmp expected5 actual5 &&
130
- test_cmp expected6 actual6
131
-'
132
-
79
test_expect_success 'string pool' '
80
echo a does not equal b >expected.differ &&
81
echo a equals a >expected.match &&
t/t0081-line-buffer.sh
new
+67
@@ -0,0 +1,67 @@
1
+#!/bin/sh
2
+
3
+test_description="Test the svn importer's input handling routines.
4
+"
5
+. ./test-lib.sh
6
+
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
14
+'
15
+
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
20
+
21
+ copy 5
22
+ HELLO
23
+ EOF
24
+ test_cmp expect actual
25
+'
26
+
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
31
+ Q
32
+ EOF
33
+ test_cmp expect actual
34
+'
35
+
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
40
+
41
+ copy 1
42
+ Q
43
+ EOF
44
+ test_cmp expect actual
45
+'
46
+
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
54
+'
55
+
56
+test_expect_success 'long copies are truncated' '
57
+ printf "%s\n" "" foo >expect &&
58
+ test-line-buffer <<-\EOF >actual &&
59
+ read 0
60
+
61
+ copy 5
62
+ foo
63
+ EOF
64
+ test_cmp expect actual
65
+'
66
+
67
+test_done