public function testParsingToplevelStatements() { $parser = new Scheme_Parser(); $result = $parser->parseToplevelStatements('(+ 1 2) (+ 3 4)'); $this->assertTrue(is_array($result)); $this->assertEquals(2, count($result)); $this->assertEquals('(+ 1 2)', $result[0]->toString()); $this->assertEquals('(+ 3 4)', $result[1]->toString()); }
private function runTestFile($file) { $code = file_get_contents($file); $testName = basename($file, '.test.ss'); $parser = new Scheme_Parser(); $interpreter = new Scheme_Interpreter(); $rootEnv = $interpreter->createEnv(); $this->bindLibs($rootEnv); try { $stmts = $parser->parseToplevelStatements($code); foreach ($stmts as $stmt) { $interpreter->evaluate($rootEnv, $stmt); } } catch (Exception $ex) { $this->reporter->addFailure('TestRunner_Scheme', $testName, $ex); } if (!isset($ex)) { $this->reporter->addSuccess('TestRunner_Scheme', $testName); } }