From f632b6578b7b1dab0a9779515ad9b54c8a322bdd Mon Sep 17 00:00:00 2001 From: rhysd Date: Mon, 8 Jun 2015 16:29:02 +0900 Subject: [PATCH] fix spec --- spec/crisp/interpreter_spec.cr | 19 +++++++++++++------ spec/helper.cr | 4 +--- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/spec/crisp/interpreter_spec.cr b/spec/crisp/interpreter_spec.cr index 9c243f2..8973f77 100644 --- a/spec/crisp/interpreter_spec.cr +++ b/spec/crisp/interpreter_spec.cr @@ -1,15 +1,22 @@ require "../helper" -require_crisp "interpreter" -describe "Crisp::Interpreter" - describe "#eval_string" - it "evaluates string of Crisp expression" +describe "Crisp::Interpreter" do + describe "#eval_string" do + it "evaluates string of Crisp expression" do i = Crisp::Interpreter.new result = i.eval_string "(+ 1 2)" result.should be_a(Crisp::Type) unwrapped = result.unwrap - result.should be_a(Int32) - result.should eq(unwrapped, 3) + unwrapped.should be_a(Int32) + unwrapped.should eq(3) + end + end + + describe "#run" do + it "raises eval error with file which doesn't exist" do + expect_raises Crisp::EvalException do + Crisp::Interpreter.new "/non/existent/file" + end end end end diff --git a/spec/helper.cr b/spec/helper.cr index f399963..46caee2 100644 --- a/spec/helper.cr +++ b/spec/helper.cr @@ -1,5 +1,3 @@ require "spec" +require "../src/crisp" -macro require_crisp(module) - require "../../src/crisp/{{module}}" -end