@@ -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
5659end __TestDiffFilesInFolder
5760
@@ -78,6 +81,23 @@ command __TestDiffFiles pFileA, pFileB, pReferenceFile, pDescription
7881 TestAssert pDescription , tDiff is tReferenceDiff
7982end __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+
81101private function get_library_folder
82102 return TestGetEngineRepositoryPath() & "/extensions/script-libraries/diff"
83103end get_library_folder
0 commit comments