Page MenuHomec4science

PhutilLanguageGuesserTestCase.php
No OneTemporary

File Metadata

Created
Fri, Nov 15, 12:34

PhutilLanguageGuesserTestCase.php

<?php
/**
* @group testcase
*/
final class PhutilLanguageGuesserTestCase extends PhutilTestCase {
public function testGuessing() {
$dir = dirname(__FILE__).'/languageguesser/';
foreach (Filesystem::listDirectory($dir, $hidden = false) as $test) {
$source = Filesystem::readFile($dir.$test);
if (strpos($test, '.') !== false) {
$expect = head(explode('.', $test));
} else {
$expect = null;
}
$this->assertEqual(
$expect,
PhutilLanguageGuesser::guessLanguage($source),
"Guessed language for '{$test}'.");
}
}
}

Event Timeline