r68498 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68497‎ | r68498 | r68499 >
Date:02:52, 24 June 2010
Author:tstarling
Status:deferred
Tags:
Comment:
Converted the existing test cases to *.phpt format. Merged the two test directories.
Modified paths:
  • /trunk/extensions/wikidiff2/test (deleted) (history)
  • /trunk/extensions/wikidiff2/tests/001.phpt (modified) (history)
  • /trunk/extensions/wikidiff2/tests/002.phpt (added) (history)
  • /trunk/extensions/wikidiff2/tests/chinese-reverse.zip (added) (history)

Diff [purge]

Index: trunk/extensions/wikidiff2/tests/chinese-reverse.zip
Cannot display: file marked as a binary type.
svn:mime-type = application/zip
Property changes on: trunk/extensions/wikidiff2/tests/chinese-reverse.zip
___________________________________________________________________
Name: svn:mime-type
11 + application/zip
Index: trunk/extensions/wikidiff2/tests/001.phpt
@@ -1,21 +1,403 @@
22 --TEST--
3 -Check for wikidiff2 presence
 3+Diff test A
44 --SKIPIF--
55 <?php if (!extension_loaded("wikidiff2")) print "skip"; ?>
66 --FILE--
77 <?php
8 -echo "wikidiff2 extension is available";
9 -/*
10 - you can add regression tests for your extension here
 8+$x = <<<EOT
 9+== Added line ==
1110
12 - the output of your test code has to be equal to the
13 - text in the --EXPECT-- section below for the tests
14 - to pass, differences between the output and the
15 - expected text are interpreted as failure
 11+== Removed line ==
1612
17 - see php5/README.TESTING for further information on
18 - writing regression tests
19 -*/
 13+kjahegwnygw
 14+== Moved text ==
 15+a
 16+---line---
 17+a
 18+a
 19+a
 20+a
 21+a
 22+a
 23+a
 24+a
 25+== Two moved lines ==
 26+a
 27+a
 28+a
 29+--line1--
 30+--line2--
 31+a
 32+a
 33+a
 34+a
 35+a
 36+a
 37+a
 38+a
 39+a
 40+a
 41+a
 42+a
 43+a
 44+== Shortest sequence in Y ==
 45+x1
 46+x2
 47+x1
 48+x2
 49+x1
 50+x2
 51+x1
 52+x2
 53+context
 54+context
 55+context
 56+context
 57+context
 58+== Changed line ==
 59+blah blah blah 1
 60+
 61+
 62+EOT;
 63+
 64+#---------------------------------------------------
 65+
 66+$y = <<<EOT
 67+== Added line ==
 68+
 69+sjgfkdjfgb
 70+== Removed line ==
 71+
 72+== Moved text ==
 73+a
 74+a
 75+a
 76+a
 77+a
 78+a
 79+a
 80+---line---
 81+a
 82+a
 83+== Two moved lines ==
 84+a
 85+a
 86+a
 87+a
 88+a
 89+a
 90+a
 91+a
 92+a
 93+a
 94+a
 95+--line1--
 96+--line2--
 97+a
 98+a
 99+a
 100+a
 101+a
 102+== Shortest sequence in Y ==
 103+x2
 104+x1
 105+x2
 106+x1
 107+context
 108+context
 109+context
 110+context
 111+context
 112+== Changed line ==
 113+blah blah blah 2
 114+
 115+
 116+EOT;
 117+
 118+#---------------------------------------------------
 119+
 120+print wikidiff2_do_diff( $x, $y, 2 );
 121+
20122 ?>
21123 --EXPECT--
22 -wikidiff2 extension is available
 124+<tr>
 125+ <td colspan="2" class="diff-lineno"><!--LINE 1--></td>
 126+ <td colspan="2" class="diff-lineno"><!--LINE 1--></td>
 127+</tr>
 128+<tr>
 129+ <td class="diff-marker"> </td>
 130+ <td class="diff-context"><div>== Added line ==</div></td>
 131+ <td class="diff-marker"> </td>
 132+ <td class="diff-context"><div>== Added line ==</div></td>
 133+</tr>
 134+<tr>
 135+ <td class="diff-marker"> </td>
 136+ <td class="diff-context"></td>
 137+ <td class="diff-marker"> </td>
 138+ <td class="diff-context"></td>
 139+</tr>
 140+<tr>
 141+ <td colspan="2">&nbsp;</td>
 142+ <td class="diff-marker">+</td>
 143+ <td class="diff-addedline"><div>sjgfkdjfgb</div></td>
 144+</tr>
 145+<tr>
 146+ <td class="diff-marker"> </td>
 147+ <td class="diff-context"><div>== Removed line ==</div></td>
 148+ <td class="diff-marker"> </td>
 149+ <td class="diff-context"><div>== Removed line ==</div></td>
 150+</tr>
 151+<tr>
 152+ <td class="diff-marker"> </td>
 153+ <td class="diff-context"></td>
 154+ <td class="diff-marker"> </td>
 155+ <td class="diff-context"></td>
 156+</tr>
 157+<tr>
 158+ <td class="diff-marker">-</td>
 159+ <td class="diff-deletedline"><div>kjahegwnygw</div></td>
 160+ <td colspan="2">&nbsp;</td>
 161+</tr>
 162+<tr>
 163+ <td class="diff-marker"> </td>
 164+ <td class="diff-context"><div>== Moved text ==</div></td>
 165+ <td class="diff-marker"> </td>
 166+ <td class="diff-context"><div>== Moved text ==</div></td>
 167+</tr>
 168+<tr>
 169+ <td class="diff-marker"> </td>
 170+ <td class="diff-context"><div>a</div></td>
 171+ <td class="diff-marker"> </td>
 172+ <td class="diff-context"><div>a</div></td>
 173+</tr>
 174+<tr>
 175+ <td class="diff-marker">-</td>
 176+ <td class="diff-deletedline"><div>---line---</div></td>
 177+ <td colspan="2">&nbsp;</td>
 178+</tr>
 179+<tr>
 180+ <td class="diff-marker"> </td>
 181+ <td class="diff-context"><div>a</div></td>
 182+ <td class="diff-marker"> </td>
 183+ <td class="diff-context"><div>a</div></td>
 184+</tr>
 185+<tr>
 186+ <td class="diff-marker"> </td>
 187+ <td class="diff-context"><div>a</div></td>
 188+ <td class="diff-marker"> </td>
 189+ <td class="diff-context"><div>a</div></td>
 190+</tr>
 191+<tr>
 192+ <td colspan="2" class="diff-lineno"><!--LINE 13--></td>
 193+ <td colspan="2" class="diff-lineno"><!--LINE 12--></td>
 194+</tr>
 195+<tr>
 196+ <td class="diff-marker"> </td>
 197+ <td class="diff-context"><div>a</div></td>
 198+ <td class="diff-marker"> </td>
 199+ <td class="diff-context"><div>a</div></td>
 200+</tr>
 201+<tr>
 202+ <td class="diff-marker"> </td>
 203+ <td class="diff-context"><div>a</div></td>
 204+ <td class="diff-marker"> </td>
 205+ <td class="diff-context"><div>a</div></td>
 206+</tr>
 207+<tr>
 208+ <td colspan="2">&nbsp;</td>
 209+ <td class="diff-marker">+</td>
 210+ <td class="diff-addedline"><div>---line---</div></td>
 211+</tr>
 212+<tr>
 213+ <td class="diff-marker"> </td>
 214+ <td class="diff-context"><div>a</div></td>
 215+ <td class="diff-marker"> </td>
 216+ <td class="diff-context"><div>a</div></td>
 217+</tr>
 218+<tr>
 219+ <td class="diff-marker"> </td>
 220+ <td class="diff-context"><div>a</div></td>
 221+ <td class="diff-marker"> </td>
 222+ <td class="diff-context"><div>a</div></td>
 223+</tr>
 224+<tr>
 225+ <td colspan="2" class="diff-lineno"><!--LINE 19--></td>
 226+ <td colspan="2" class="diff-lineno"><!--LINE 19--></td>
 227+</tr>
 228+<tr>
 229+ <td class="diff-marker"> </td>
 230+ <td class="diff-context"><div>a</div></td>
 231+ <td class="diff-marker"> </td>
 232+ <td class="diff-context"><div>a</div></td>
 233+</tr>
 234+<tr>
 235+ <td class="diff-marker"> </td>
 236+ <td class="diff-context"><div>a</div></td>
 237+ <td class="diff-marker"> </td>
 238+ <td class="diff-context"><div>a</div></td>
 239+</tr>
 240+<tr>
 241+ <td class="diff-marker">-</td>
 242+ <td class="diff-deletedline"><div>--line1--</div></td>
 243+ <td colspan="2">&nbsp;</td>
 244+</tr>
 245+<tr>
 246+ <td class="diff-marker">-</td>
 247+ <td class="diff-deletedline"><div>--line2--</div></td>
 248+ <td colspan="2">&nbsp;</td>
 249+</tr>
 250+<tr>
 251+ <td class="diff-marker"> </td>
 252+ <td class="diff-context"><div>a</div></td>
 253+ <td class="diff-marker"> </td>
 254+ <td class="diff-context"><div>a</div></td>
 255+</tr>
 256+<tr>
 257+ <td class="diff-marker"> </td>
 258+ <td class="diff-context"><div>a</div></td>
 259+ <td class="diff-marker"> </td>
 260+ <td class="diff-context"><div>a</div></td>
 261+</tr>
 262+<tr>
 263+ <td colspan="2" class="diff-lineno"><!--LINE 29--></td>
 264+ <td colspan="2" class="diff-lineno"><!--LINE 27--></td>
 265+</tr>
 266+<tr>
 267+ <td class="diff-marker"> </td>
 268+ <td class="diff-context"><div>a</div></td>
 269+ <td class="diff-marker"> </td>
 270+ <td class="diff-context"><div>a</div></td>
 271+</tr>
 272+<tr>
 273+ <td class="diff-marker"> </td>
 274+ <td class="diff-context"><div>a</div></td>
 275+ <td class="diff-marker"> </td>
 276+ <td class="diff-context"><div>a</div></td>
 277+</tr>
 278+<tr>
 279+ <td colspan="2">&nbsp;</td>
 280+ <td class="diff-marker">+</td>
 281+ <td class="diff-addedline"><div>--line1--</div></td>
 282+</tr>
 283+<tr>
 284+ <td colspan="2">&nbsp;</td>
 285+ <td class="diff-marker">+</td>
 286+ <td class="diff-addedline"><div>--line2--</div></td>
 287+</tr>
 288+<tr>
 289+ <td class="diff-marker"> </td>
 290+ <td class="diff-context"><div>a</div></td>
 291+ <td class="diff-marker"> </td>
 292+ <td class="diff-context"><div>a</div></td>
 293+</tr>
 294+<tr>
 295+ <td class="diff-marker"> </td>
 296+ <td class="diff-context"><div>a</div></td>
 297+ <td class="diff-marker"> </td>
 298+ <td class="diff-context"><div>a</div></td>
 299+</tr>
 300+<tr>
 301+ <td colspan="2" class="diff-lineno"><!--LINE 35--></td>
 302+ <td colspan="2" class="diff-lineno"><!--LINE 35--></td>
 303+</tr>
 304+<tr>
 305+ <td class="diff-marker"> </td>
 306+ <td class="diff-context"><div>a</div></td>
 307+ <td class="diff-marker"> </td>
 308+ <td class="diff-context"><div>a</div></td>
 309+</tr>
 310+<tr>
 311+ <td class="diff-marker"> </td>
 312+ <td class="diff-context"><div>== Shortest sequence in Y ==</div></td>
 313+ <td class="diff-marker"> </td>
 314+ <td class="diff-context"><div>== Shortest sequence in Y ==</div></td>
 315+</tr>
 316+<tr>
 317+ <td class="diff-marker">-</td>
 318+ <td class="diff-deletedline"><div>x1</div></td>
 319+ <td colspan="2">&nbsp;</td>
 320+</tr>
 321+<tr>
 322+ <td class="diff-marker"> </td>
 323+ <td class="diff-context"><div>x2</div></td>
 324+ <td class="diff-marker"> </td>
 325+ <td class="diff-context"><div>x2</div></td>
 326+</tr>
 327+<tr>
 328+ <td class="diff-marker"> </td>
 329+ <td class="diff-context"><div>x1</div></td>
 330+ <td class="diff-marker"> </td>
 331+ <td class="diff-context"><div>x1</div></td>
 332+</tr>
 333+<tr>
 334+ <td class="diff-marker"> </td>
 335+ <td class="diff-context"><div>x2</div></td>
 336+ <td class="diff-marker"> </td>
 337+ <td class="diff-context"><div>x2</div></td>
 338+</tr>
 339+<tr>
 340+ <td class="diff-marker"> </td>
 341+ <td class="diff-context"><div>x1</div></td>
 342+ <td class="diff-marker"> </td>
 343+ <td class="diff-context"><div>x1</div></td>
 344+</tr>
 345+<tr>
 346+ <td class="diff-marker">-</td>
 347+ <td class="diff-deletedline"><div>x2</div></td>
 348+ <td colspan="2">&nbsp;</td>
 349+</tr>
 350+<tr>
 351+ <td class="diff-marker">-</td>
 352+ <td class="diff-deletedline"><div>x1</div></td>
 353+ <td colspan="2">&nbsp;</td>
 354+</tr>
 355+<tr>
 356+ <td class="diff-marker">-</td>
 357+ <td class="diff-deletedline"><div>x2</div></td>
 358+ <td colspan="2">&nbsp;</td>
 359+</tr>
 360+<tr>
 361+ <td class="diff-marker"> </td>
 362+ <td class="diff-context"><div>context</div></td>
 363+ <td class="diff-marker"> </td>
 364+ <td class="diff-context"><div>context</div></td>
 365+</tr>
 366+<tr>
 367+ <td class="diff-marker"> </td>
 368+ <td class="diff-context"><div>context</div></td>
 369+ <td class="diff-marker"> </td>
 370+ <td class="diff-context"><div>context</div></td>
 371+</tr>
 372+<tr>
 373+ <td colspan="2" class="diff-lineno"><!--LINE 49--></td>
 374+ <td colspan="2" class="diff-lineno"><!--LINE 45--></td>
 375+</tr>
 376+<tr>
 377+ <td class="diff-marker"> </td>
 378+ <td class="diff-context"><div>context</div></td>
 379+ <td class="diff-marker"> </td>
 380+ <td class="diff-context"><div>context</div></td>
 381+</tr>
 382+<tr>
 383+ <td class="diff-marker"> </td>
 384+ <td class="diff-context"><div>== Changed line ==</div></td>
 385+ <td class="diff-marker"> </td>
 386+ <td class="diff-context"><div>== Changed line ==</div></td>
 387+</tr>
 388+<tr>
 389+ <td class="diff-marker">-</td>
 390+ <td class="diff-deletedline"><div>
 391+blah blah blah <span class="diffchange diffchange-inline">1</span>
 392+ </div></td>
 393+ <td class="diff-marker">+</td>
 394+ <td class="diff-addedline"><div>
 395+blah blah blah <span class="diffchange diffchange-inline">2</span>
 396+ </div></td>
 397+</tr>
 398+<tr>
 399+ <td class="diff-marker"> </td>
 400+ <td class="diff-context"></td>
 401+ <td class="diff-marker"> </td>
 402+ <td class="diff-context"></td>
 403+</tr>
 404+
Index: trunk/extensions/wikidiff2/tests/002.phpt
@@ -0,0 +1,114 @@
 2+--TEST--
 3+Diff test B
 4+--SKIPIF--
 5+<?php if (!extension_loaded("wikidiff2")) print "skip"; ?>
 6+--FILE--
 7+<?php
 8+$x = <<<EOT
 9+== Shortest sequence in X ==
 10+x2
 11+x1
 12+x2
 13+x1
 14+context
 15+context
 16+context
 17+context
 18+context
 19+
 20+
 21+EOT;
 22+
 23+#---------------------------------------------------
 24+
 25+$y = <<<EOT
 26+== Shortest sequence in X ==
 27+x1
 28+x2
 29+x1
 30+x2
 31+x1
 32+x2
 33+x1
 34+x2
 35+context
 36+context
 37+context
 38+context
 39+context
 40+
 41+
 42+EOT;
 43+
 44+#---------------------------------------------------
 45+
 46+print wikidiff2_do_diff( $x, $y, 2 );
 47+
 48+?>
 49+--EXPECT--
 50+<tr>
 51+ <td colspan="2" class="diff-lineno"><!--LINE 1--></td>
 52+ <td colspan="2" class="diff-lineno"><!--LINE 1--></td>
 53+</tr>
 54+<tr>
 55+ <td class="diff-marker"> </td>
 56+ <td class="diff-context"><div>== Shortest sequence in X ==</div></td>
 57+ <td class="diff-marker"> </td>
 58+ <td class="diff-context"><div>== Shortest sequence in X ==</div></td>
 59+</tr>
 60+<tr>
 61+ <td colspan="2">&nbsp;</td>
 62+ <td class="diff-marker">+</td>
 63+ <td class="diff-addedline"><div>x1</div></td>
 64+</tr>
 65+<tr>
 66+ <td class="diff-marker"> </td>
 67+ <td class="diff-context"><div>x2</div></td>
 68+ <td class="diff-marker"> </td>
 69+ <td class="diff-context"><div>x2</div></td>
 70+</tr>
 71+<tr>
 72+ <td class="diff-marker"> </td>
 73+ <td class="diff-context"><div>x1</div></td>
 74+ <td class="diff-marker"> </td>
 75+ <td class="diff-context"><div>x1</div></td>
 76+</tr>
 77+<tr>
 78+ <td class="diff-marker"> </td>
 79+ <td class="diff-context"><div>x2</div></td>
 80+ <td class="diff-marker"> </td>
 81+ <td class="diff-context"><div>x2</div></td>
 82+</tr>
 83+<tr>
 84+ <td class="diff-marker"> </td>
 85+ <td class="diff-context"><div>x1</div></td>
 86+ <td class="diff-marker"> </td>
 87+ <td class="diff-context"><div>x1</div></td>
 88+</tr>
 89+<tr>
 90+ <td colspan="2">&nbsp;</td>
 91+ <td class="diff-marker">+</td>
 92+ <td class="diff-addedline"><div>x2</div></td>
 93+</tr>
 94+<tr>
 95+ <td colspan="2">&nbsp;</td>
 96+ <td class="diff-marker">+</td>
 97+ <td class="diff-addedline"><div>x1</div></td>
 98+</tr>
 99+<tr>
 100+ <td colspan="2">&nbsp;</td>
 101+ <td class="diff-marker">+</td>
 102+ <td class="diff-addedline"><div>x2</div></td>
 103+</tr>
 104+<tr>
 105+ <td class="diff-marker"> </td>
 106+ <td class="diff-context"><div>context</div></td>
 107+ <td class="diff-marker"> </td>
 108+ <td class="diff-context"><div>context</div></td>
 109+</tr>
 110+<tr>
 111+ <td class="diff-marker"> </td>
 112+ <td class="diff-context"><div>context</div></td>
 113+ <td class="diff-marker"> </td>
 114+ <td class="diff-context"><div>context</div></td>
 115+</tr>

Status & tagging log