Sha256: 59309744637ad44c5ce0b4dd0356f9e60c17cd78b56860d59227da18d9c01834
Contents?: true
Size: 676 Bytes
Versions: 2
Compression:
Stored size: 676 Bytes
Contents
require 'rspec' describe Shuwar::Runtime do def rt; Shuwar::Runtime.new; end def run(obj) rt.evaluate obj end it "should handle literals" do expect(run 1).to eq 1 end it "should handle symbols" do expect(run :load).not_to be_nil end it "should handle lambdas" do expect(run [:lambda, [:a, :b], :a, :b]).not_to be_nil end it "should handle set" do a = rt a.evaluate [:set, :a, 1] expect(a.evaluate :a).to eq 1 end it "should be able to do lexical scoping" do a = rt a.evaluate [:set, :a, 1] a.evaluate [:set, :b, [:lambda, [], [:set, :a, 2]]] a.evaluate [:b] expect(a.evaluate :a).to eq 1 end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
shuwar-1.3.0 | spec/runtime_spec.rb |
shuwar-1.2.0 | spec/runtime_spec.rb |