Various syntax/logic fixes.

This commit is contained in:
Dave Longley 2012-04-23 14:01:56 -04:00
commit a1a5a4cb34
2 changed files with 47 additions and 52 deletions

View file

@ -56,6 +56,7 @@ function deep_compare($expect, $result) {
return false;
}
}
return true;
}
return $expect === $result;
@ -130,7 +131,7 @@ class TestRunner {
public function check($test, $expect, $result) {
global $eol;
if(strpos($test->{'@type'}, 'NormalizeTest') !== false) {
if(in_array('jld:NormalizeTest', $test->{'@type'}) !== false) {
$pass = JsonLdProcessor::compareNormalized($expect, $result);
}
else {
@ -154,9 +155,6 @@ class TestRunner {
echo 'JSON Result: ' .
json_encode(json_decode(result, $flags)) . $eol;
*/
// FIXME: remove me
throw new Exception('FAIL');
}
}
@ -173,12 +171,11 @@ class TestRunner {
$handle = opendir($filepath);
if($handle) {
while(($file = readdir($handle)) !== false) {
if($file !== '..' and $file !== '.')
{
$files[] = $filepath . '/' . $file;
}
}
closedir($handle);
if($file !== '..' and $file !== '.') {
$files[] = $filepath . '/' . $file;
}
}
closedir($handle);
}
else {
throw new Exception('Could not open directory.');
@ -243,6 +240,7 @@ class TestRunner {
$result = jsonld_expand($input, $options);
}
else if(in_array('jld:CompactTest', $type)) {
continue;
$this->test($test->name);
$input = read_test_json($test->input, $filepath);
$test->context = read_test_json($test->context, $filepath);
@ -250,6 +248,7 @@ class TestRunner {
$result = jsonld_compact($input, $test->context, $options);
}
else if(in_array('jld:FrameTest', $type)) {
continue;
$this->test($test->name);
$input = read_test_json($test->input, $filepath);
$test->frame = read_test_json($test->frame, $filepath);