Example #1
0
 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);
     }
 }
 public function evaluate($env, $value)
 {
     ++$this->stackDepth;
     if ($this->stackDepth > $this->maxStackDepth) {
         $this->maxStackDepth = $this->stackDepth;
     }
     try {
         $ret = parent::evaluate($env, $value);
     } catch (Exception $e) {
         --$this->stackDepth;
         throw $e;
     }
     --$this->stackDepth;
     return $ret;
 }