-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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>
- Loading branch information
Jonathan Nieder
committed
Feb 26, 2011
1 parent
850c5ea
commit 232087f
Showing
2 changed files
with
67 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/bin/sh | ||
|
||
test_description="Test the svn importer's input handling routines. | ||
" | ||
. ./test-lib.sh | ||
|
||
test_expect_success 'read greeting' ' | ||
echo HELLO >expect && | ||
test-line-buffer <<-\EOF >actual && | ||
read 5 | ||
HELLO | ||
EOF | ||
test_cmp expect actual | ||
' | ||
|
||
test_expect_success '0-length read, send along greeting' ' | ||
printf "%s\n" "" HELLO >expect && | ||
test-line-buffer <<-\EOF >actual && | ||
read 0 | ||
copy 5 | ||
HELLO | ||
EOF | ||
test_cmp expect actual | ||
' | ||
|
||
test_expect_success 'buffer_read_string copes with trailing null byte' ' | ||
echo >expect && | ||
q_to_nul <<-\EOF | test-line-buffer >actual && | ||
read 1 | ||
Q | ||
EOF | ||
test_cmp expect actual | ||
' | ||
|
||
test_expect_success '0-length read, copy null byte' ' | ||
printf "%s\n" "" Q | q_to_nul >expect && | ||
q_to_nul <<-\EOF | test-line-buffer >actual && | ||
read 0 | ||
copy 1 | ||
Q | ||
EOF | ||
test_cmp expect actual | ||
' | ||
|
||
test_expect_success 'long reads are truncated' ' | ||
printf "%s\n" foo "" >expect && | ||
test-line-buffer <<-\EOF >actual && | ||
read 5 | ||
foo | ||
EOF | ||
test_cmp expect actual | ||
' | ||
|
||
test_expect_success 'long copies are truncated' ' | ||
printf "%s\n" "" foo >expect && | ||
test-line-buffer <<-\EOF >actual && | ||
read 0 | ||
copy 5 | ||
foo | ||
EOF | ||
test_cmp expect actual | ||
' | ||
|
||
test_done |