From a5b09ab0590628fff7868de795f5c158e86e6581 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Mon, 21 Sep 2015 00:09:11 +0300 Subject: [PATCH] fixed interpreter tests --- test/interpreter/test_add.rb | 7 +++++-- test/interpreter/test_puts.rb | 9 +++++++-- test/test_all.rb | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/test/interpreter/test_add.rb b/test/interpreter/test_add.rb index 33f37857..fea397bd 100644 --- a/test/interpreter/test_add.rb +++ b/test/interpreter/test_add.rb @@ -1,10 +1,13 @@ require_relative "helper" class AddTest < MiniTest::Test - + include AST::Sexp def setup Virtual.machine.boot - code =Ast::OperatorExpression.new("+", Ast::IntegerExpression.new(2),Ast::IntegerExpression.new(5)) + code = s(:call, + s(:name, :plus), + s(:arguments , s(:int , 5)), + s(:receiver, s(:int, 2))) Bosl::Compiler.compile( code , Virtual.machine.space.get_main ) Virtual.machine.run_before "Register::CallImplementation" @interpreter = Interpreter::Interpreter.new diff --git a/test/interpreter/test_puts.rb b/test/interpreter/test_puts.rb index c8bc28a6..29858b9d 100644 --- a/test/interpreter/test_puts.rb +++ b/test/interpreter/test_puts.rb @@ -1,10 +1,15 @@ require_relative "helper" class TestPuts < MiniTest::Test - + include AST::Sexp def setup Virtual.machine.boot - code = Ast::ExpressionList.new( [Ast::CallSiteExpression.new(:putstring, [] ,Ast::StringExpression.new("Hello again"))]) + code = s(:call, + s(:name, :putstring), + s(:arguments), + s(:receiver, + s(:string, "Hello again"))) + Bosl::Compiler.compile( code , Virtual.machine.space.get_main ) Virtual.machine.run_before "Register::CallImplementation" @interpreter = Interpreter::Interpreter.new diff --git a/test/test_all.rb b/test/test_all.rb index a1e09dd2..71f7f667 100644 --- a/test/test_all.rb +++ b/test/test_all.rb @@ -6,4 +6,4 @@ require_relative "fragments/test_all" #require_relative "virtual/test_all" -#require_relative "interpreter/test_all" +require_relative "interpreter/test_all"