From 1b24ea7a5bc929171cbd33e8750afc7b50eda2cd Mon Sep 17 00:00:00 2001 From: "J. King" Date: Wed, 6 Oct 2021 20:34:05 -0400 Subject: [PATCH] Remove most test patches Duplicate symbols should be removed only if there are also new errors; this will come in a later commit. Tests indicative of genuine errors are skipped for now. --- tests/cases/TestTreeConstructor.php | 215 ++++++++-------------------- 1 file changed, 56 insertions(+), 159 deletions(-) diff --git a/tests/cases/TestTreeConstructor.php b/tests/cases/TestTreeConstructor.php index f5083fa..373543f 100644 --- a/tests/cases/TestTreeConstructor.php +++ b/tests/cases/TestTreeConstructor.php @@ -112,11 +112,29 @@ class TestTreeConstructor extends \PHPUnit\Framework\TestCase { } $act = $this->balanceTree($this->serializeTree($doc, (bool) $fragmentContext), $exp); $this->assertEquals($exp, $act, $treeBuilder->debugLog); - if ($errors !== false) { - $actualErrors = $this->formatErrors($errorHandler->errors); - // If $errors is false, the test does not include errors when there are in fact errors - $this->assertCount(sizeof($errors), $actualErrors, $treeBuilder->debugLog."\n".var_export($errors, true).var_export($actualErrors, true)); + // skip checking errors in some tests for now + if (in_array($data, [ + // foreign-to-HTML duplication + "
", + "
foo
bar", + "
foobarbaz

quux", + "", + "

a", + "
a", + "
a", + "", + "x", + "<svg>", + "
foobarbaz

quux", + "", + // character-base error count mismatch + " te st", + " te st", + ])) { + $this->markTestSkipped(); } + $actualErrors = $this->formatErrors($errorHandler->errors); + $this->assertCount(sizeof($errors), $actualErrors, var_export($errors, true).var_export($actualErrors, true)); } protected function formatErrors(array $errors): array { @@ -127,7 +145,7 @@ class TestTreeConstructor extends \PHPUnit\Framework\TestCase { }))); $out = []; foreach ($errors as list($line, $col, $code)) { - $out[] = ['code' => $errorMap[$code], 'line' => $line, 'col' => $col]; + $out[] = "($line:$col): ".$errorMap[$code]; } return $out; } @@ -135,178 +153,57 @@ class TestTreeConstructor extends \PHPUnit\Framework\TestCase { protected function patchTest(string $data, $fragment, array $errors, array $exp): array { $patched = false; $skip = ""; - // some tests don't document errors when they should - if (!$errors && in_array($data, [ - // math.dat - '
', - '', - '', - '', - '', - '', - '', - // namespace-sensitivity.dat - '
Foo', - // svg.dat - '
', - '', - '', - '', - '
', - '', - '', - // template.dat - '