File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
src/core/diff/strategies/__tests__ Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -1436,6 +1436,25 @@ function five() {
14361436 expect ( result . success ) . toBe ( true )
14371437 } )
14381438
1439+ it ( "handles escaping of markers with custom suffixes" , async ( ) => {
1440+ const originalContent = "before\n<<<<<<< HEAD\nmiddle\n>>>>>>> feature-branch\nafter\n"
1441+ const diffContent =
1442+ "<<<<<<< SEARCH\n" +
1443+ "before\n" +
1444+ "\\<<<<<<< HEAD\n" +
1445+ "middle\n" +
1446+ "\\>>>>>>> feature-branch\n" +
1447+ "after\n" +
1448+ "=======\n" +
1449+ "replaced content\n" +
1450+ ">>>>>>> REPLACE"
1451+ const result = await strategy . applyDiff ( originalContent , diffContent )
1452+ expect ( result . success ) . toBe ( true )
1453+ if ( result . success ) {
1454+ expect ( result . content ) . toBe ( "replaced content\n" )
1455+ }
1456+ } )
1457+
14391458 it ( "detects separator when expecting replace" , ( ) => {
14401459 const diff = "<<<<<<< SEARCH\n" + "content\n" + "=======\n" + "new content\n" + "======="
14411460 const result = strategy [ "validateMarkerSequencing" ] ( diff )
You can’t perform that action at this time.
0 commit comments