Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit ff8118c

Browse files
committed
[[ Diff ]] Add DiffPatch test applied to all test cases
1 parent 4738fe2 commit ff8118c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

extensions/script-libraries/diff/test/diff.livecodescript

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ command __TestDiffFilesInFolder pFolder, pFileA, pFileB, pDescription
5252
__TestDiffFiles (pFileA & ".txt"), (pFileB & ".txt"), (pFileA & "_" & pFileB & ".diff"), (pDescription & " - " & pFileA & " -> " & pFileB)
5353
__TestDiffFiles (pFileB & ".txt"), (pFileA & ".txt"), (pFileB & "_" & pFileA & ".diff"), (pDescription & " - " & pFileB & " -> " & pFileA)
5454

55+
__TestPatchFiles (pFileA & ".txt"), (pFileB & ".txt"), (pFileA & "_" & pFileB & ".diff"), (pDescription & " - PATCH " & pFileA & " -> " & pFileB)
56+
__TestPatchFiles (pFileB & ".txt"), (pFileA & ".txt"), (pFileB & "_" & pFileA & ".diff"), (pDescription & " - PATCH " & pFileB & " -> " & pFileA)
57+
5558
set the defaultFolder to tDefaultFolder
5659
end __TestDiffFilesInFolder
5760

@@ -78,6 +81,23 @@ command __TestDiffFiles pFileA, pFileB, pReferenceFile, pDescription
7881
TestAssert pDescription, tDiff is tReferenceDiff
7982
end __TestDiffFiles
8083

84+
command __TestPatchFiles pFileA, pFileB, pDiffFile, pDescription
85+
local tA, tB, tDiff
86+
87+
// catch missing files
88+
TestAssert "file exists - " & pFileA, there is a file pFileA
89+
TestAssert "file exists - " & pFileB, there is a file pFileB
90+
TestAssert "file exists - " & pDiffFile, there is a file pDiffFile
91+
92+
put url ("binfile:" & pFileA) into tA
93+
put url ("binfile:" & pFileB) into tB
94+
put url ("binfile:" & pDiffFile) into tDiff
95+
96+
put DiffPatch(tA, tDiff) into tA
97+
98+
TestAssert pDescription, tA is tB
99+
end __TestPatchFiles
100+
81101
private function get_library_folder
82102
return TestGetEngineRepositoryPath() & "/extensions/script-libraries/diff"
83103
end get_library_folder

0 commit comments

Comments
 (0)