Przeglądaj źródła

fix spec

master
rhysd 9 lat temu
rodzic
commit
f632b6578b
2 zmienionych plików z 14 dodań i 9 usunięć
  1. +13
    -6
      spec/crisp/interpreter_spec.cr
  2. +1
    -3
      spec/helper.cr

+ 13
- 6
spec/crisp/interpreter_spec.cr Wyświetl plik

@ -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

+ 1
- 3
spec/helper.cr Wyświetl plik

@ -1,5 +1,3 @@
require "spec"
require "../src/crisp"
macro require_crisp(module)
require "../../src/crisp/{{module}}"
end

Ładowanie…
Anuluj
Zapisz