Browse files

Starting interpreter test

  • Loading branch information...
1 parent 90154bc commit f13eb4d1ab415cd71cac168046c904243437bc66 @txus committed Mar 30, 2011
Showing with 31 additions and 0 deletions.
  1. +31 −0 test/schemer/interpreter_test.rb
View
31 test/schemer/interpreter_test.rb
@@ -0,0 +1,31 @@
+require 'test_helper'
+
+module Schemer
+ class InterpreterTest < MiniTest::Unit::TestCase
+
+ def setup
+ @lexer = Lexer.new
+ @parser = Parser.new
+ end
+
+ def test_walks_the_ast_visiting_every_node
+ text = """
+ (define (double num)
+ (+ num num))
+
+ (write (double 12))
+ """
+
+ ast = @parser.apply(@lexer.parse text)
+ interpreter = Interpreter.new(ast)
+
+ ast.each do |node|
+ node.should_receive(:eval).with(kind_of(Environment))
+ end
+
+ interpreter.walk
+ end
+
+
+ end
+end

0 comments on commit f13eb4d

Please sign in to comment.