- Various new tests needed for full coverage, noted in comment
- Byte Order Mark detection methopd added
- Japanese encodings nt yet supported, so tests marked incomplete
- Tests requiring scripting suppressed
foreach (new \GlobIterator(\dW\HTML5\BASE."tests/html5lib-tests/encoding/*.dat", \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::CURRENT_AS_PATHNAME) as $file) {
if (!in_array(basename($file), $blacklist)) {
$tests[] = $file;
}
}
return $this->makeEncodingTests(...$tests);
}
protected function makeEncodingTests(string ...$file): iterable {
foreach ($file as $path) {
$f = basename($path);
$test = file($path);
$l = 0;
$index = 0;
while ($l <sizeof($test)){
$testId = "$f #".$index++;
$data = "";
while (!preg_match("/^#data\s+$/", $test[$l++]));
while (!preg_match("/^#encoding\s+$/", ($line = $test[$l++]))) {
$data .= $line;
}
if (in_array($testId,["tests1.dat #54", "tests1.dat #55"])) {