Example #1
0
 public function testValue()
 {
     $p = new P\Number();
     $s = self::scanner('42');
     $h = new H\Value();
     $ctx = new I\IContext();
     $p->setHandler($h);
     $p->scan($s);
     $result = $s->getContext()->pop();
     $this->assertTrue($result instanceof E);
     $result->interpret($ctx);
     $this->assertEquals(42, $ctx->get($result));
 }
Example #2
0
 public function testDebug()
 {
     $p = new I\Parser\Number('42');
     $p->setDebug(true);
     ob_start();
     $p->report('Answer');
     $res = ob_get_contents();
     $p->setDebug(false);
     ob_end_clean();
     $this->assertEquals("<Arth\\Utils\\Interpreter\\Parser\\Number[{$p->id}]>: Answer\n", $res);
 }