@@ -408,6 +408,13 @@ class DiffMatchPatch {
408
408
];
409
409
}
410
410
411
+ /**
412
+ * Hack to allow unit tests to call private method. Do not use.
413
+ */
414
+ List <Diff > test_diff_bisect (String text1, String text2, DateTime deadline) {
415
+ return _diff_bisect (text1, text2, deadline);
416
+ }
417
+
411
418
/**
412
419
* Given the location of the 'middle snake', split the diff in two parts
413
420
* and recurse.
@@ -458,6 +465,13 @@ class DiffMatchPatch {
458
465
return {'chars1' : chars1, 'chars2' : chars2, 'lineArray' : lineArray};
459
466
}
460
467
468
+ /**
469
+ * Hack to allow unit tests to call private method. Do not use.
470
+ */
471
+ Map <String , dynamic > test_diff_linesToChars (String text1, String text2) {
472
+ return _diff_linesToChars (text1, text2);
473
+ }
474
+
461
475
/**
462
476
* Split a text into a list of strings. Reduce the texts to a string of
463
477
* hashes where each Unicode character represents one line.
@@ -520,6 +534,13 @@ class DiffMatchPatch {
520
534
}
521
535
}
522
536
537
+ /**
538
+ * Hack to allow unit tests to call private method. Do not use.
539
+ */
540
+ void test_diff_charsToLines (List <Diff > diffs, List <String > lineArray) {
541
+ _diff_charsToLines (diffs, lineArray);
542
+ }
543
+
523
544
/**
524
545
* Determine the common prefix of two strings
525
546
* [text1] is the first string.
@@ -607,6 +628,13 @@ class DiffMatchPatch {
607
628
}
608
629
}
609
630
631
+ /**
632
+ * Hack to allow unit tests to call private method. Do not use.
633
+ */
634
+ int test_diff_commonOverlap (String text1, String text2) {
635
+ return _diff_commonOverlap (text1, text2);
636
+ }
637
+
610
638
/**
611
639
* Do the two texts share a substring which is at least half the length of
612
640
* the longer text?
@@ -655,6 +683,13 @@ class DiffMatchPatch {
655
683
}
656
684
}
657
685
686
+ /**
687
+ * Hack to allow unit tests to call private method. Do not use.
688
+ */
689
+ List <String > test_diff_halfMatch (String text1, String text2) {
690
+ return _diff_halfMatch (text1, text2);
691
+ }
692
+
658
693
/**
659
694
* Does a substring of shorttext exist within longtext such that the
660
695
* substring is at least half the length of longtext?
@@ -937,6 +972,13 @@ class DiffMatchPatch {
937
972
}
938
973
}
939
974
975
+ /**
976
+ * Hack to allow unit tests to call private method. Do not use.
977
+ */
978
+ void test_diff_cleanupSemanticLossless (List <Diff > diffs) {
979
+ _diff_cleanupSemanticLossless (diffs);
980
+ }
981
+
940
982
// Define some regex patterns for matching boundaries.
941
983
RegExp nonAlphaNumericRegex_ = new RegExp (r'[^a-zA-Z0-9]' );
942
984
RegExp whitespaceRegex_ = new RegExp (r'\s' );
@@ -1540,6 +1582,13 @@ class DiffMatchPatch {
1540
1582
return best_loc;
1541
1583
}
1542
1584
1585
+ /**
1586
+ * Hack to allow unit tests to call private method. Do not use.
1587
+ */
1588
+ int test_match_bitap (String text, String pattern, int loc) {
1589
+ return _match_bitap (text, pattern, loc);
1590
+ }
1591
+
1543
1592
/**
1544
1593
* Compute and return the score for a match with e errors and x location.
1545
1594
* [e] is the number of errors in match.
@@ -1574,6 +1623,13 @@ class DiffMatchPatch {
1574
1623
return s;
1575
1624
}
1576
1625
1626
+ /**
1627
+ * Hack to allow unit tests to call private method. Do not use.
1628
+ */
1629
+ Map <String , int > test_match_alphabet (String pattern) {
1630
+ return _match_alphabet (pattern);
1631
+ }
1632
+
1577
1633
// PATCH FUNCTIONS
1578
1634
1579
1635
/**
@@ -1620,6 +1676,13 @@ class DiffMatchPatch {
1620
1676
patch.length2 += prefix.length + suffix.length;
1621
1677
}
1622
1678
1679
+ /**
1680
+ * Hack to allow unit tests to call private method. Do not use.
1681
+ */
1682
+ void test_patch_addContext (Patch patch, String text) {
1683
+ _patch_addContext (patch, text);
1684
+ }
1685
+
1623
1686
/**
1624
1687
* Compute a list of patches to turn text1 into text2.
1625
1688
* Use diffs if provided, otherwise compute it ourselves.
0 commit comments