summaryrefslogtreecommitdiff
path: root/t/t9011-svn-da.sh
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2010-10-13 04:39:44 -0500
committerJonathan Nieder <jrnieder@gmail.com>2011-03-27 23:27:55 -0500
commitec71aa2e1f229b90092e6678ac7c2dca3d15b5f3 (patch)
tree020d2f4773ec563f9458ef7fe786b0631ec3a13d /t/t9011-svn-da.sh
parentef2ac77e9f8f4819f75cf52721567463e60a805c (diff)
downloadgit-ec71aa2e1f229b90092e6678ac7c2dca3d15b5f3.tar.gz
vcs-svn: implement copyfrom_data delta instruction
The copyfrom_data instruction copies a few bytes verbatim from the novel text section of a window to the postimage. [jn: with memory leak fix from David] Improved-by: David Barr <david.barr@cordelta.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Acked-by: Ramkumar Ramachandra <artagnon@gmail.com>
Diffstat (limited to 't/t9011-svn-da.sh')
-rwxr-xr-xt/t9011-svn-da.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/t/t9011-svn-da.sh b/t/t9011-svn-da.sh
index d9acd0c8a6..ba8ce052aa 100755
--- a/t/t9011-svn-da.sh
+++ b/t/t9011-svn-da.sh
@@ -138,4 +138,35 @@ test_expect_success 'reject truncated inline data (after instruction section)' '
test_must_fail test-svn-fe -d preimage insn.trunc 11
'
+test_expect_success 'copyfrom_data' '
+ echo hi >expect &&
+ printf "SVNQ%b%b%b" "QQ\003\001\003" "\0203" "hi\n" | q_to_nul >copydat &&
+ test-svn-fe -d preimage copydat 13 >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'multiple copyfrom_data' '
+ echo hi >expect &&
+ printf "SVNQ%b%b%b%b%b" "QQ\003\002\003" "\0201\0202" "hi\n" \
+ "QQQ\002Q" "\0200Q" | q_to_nul >copy.multi &&
+ len=$(wc -c <copy.multi) &&
+ test-svn-fe -d preimage copy.multi $len >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'incomplete multiple insn' '
+ printf "SVNQ%b%b%b" "QQ\003\002\003" "\0203\0200" "hi\n" |
+ q_to_nul >copy.partial &&
+ len=$(wc -c <copy.partial) &&
+ test_must_fail test-svn-fe -d preimage copy.partial $len
+'
+
+test_expect_success 'catch attempt to copy missing data' '
+ printf "SVNQ%b%b%s%b%s" "QQ\002\002\001" "\0201\0201" "X" \
+ "QQQQ\002" "YZ" |
+ q_to_nul >copy.incomplete &&
+ len=$(wc -c <copy.incomplete) &&
+ test_must_fail test-svn-fe -d preimage copy.incomplete $len
+'
+
test_done