File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -239,7 +239,7 @@ protected function renderTableBlockReplace(array $block): string
239239 $ this ->renderTableBlockDelete ($ block ) .
240240 $ this ->renderTableBlockInsert ($ block );
241241
242- continue ;
242+ break ;
243243 }
244244
245245 $ ret .= $ this ->renderTableRow ('rep ' , SequenceMatcher::OP_REP , $ mergedLine );
Original file line number Diff line number Diff line change @@ -47,4 +47,27 @@ public function testHtmlEscapeForOpEq(): void
4747 static ::assertThat ($ result , static ::logicalNot (static ::stringContains ('<tag> ' )));
4848 static ::assertThat ($ result , static ::logicalNot (static ::stringContains ('</tag> ' )));
4949 }
50+
51+ /**
52+ * Test unmerge-able block.
53+ *
54+ * @see https://github.com/jfcherng/php-diff/issues/69
55+ */
56+ public function testSimpleUnmergeableBlock (): void
57+ {
58+ $ result = DiffHelper::calculate ("111 \n222 \n333 \n" , "444 \n555 \n666 \n" , 'Combined ' );
59+
60+ static ::assertSame (
61+ [1 , 1 , 1 , 1 , 1 , 1 ],
62+ [
63+ \substr_count ($ result , '111 ' ),
64+ \substr_count ($ result , '222 ' ),
65+ \substr_count ($ result , '333 ' ),
66+ \substr_count ($ result , '444 ' ),
67+ \substr_count ($ result , '555 ' ),
68+ \substr_count ($ result , '666 ' ),
69+ ],
70+ "Unmerge-able block shouldn't be repeated. "
71+ );
72+ }
5073}
You can’t perform that action at this time.
0 commit comments