spec/unit/dialect/test_evaluate.rb in wlang-2.0.1 vs spec/unit/dialect/test_evaluate.rb in wlang-2.1.0

- old
+ new

@@ -38,9 +38,19 @@ with_scope({:who => "World"}) do evaluate("keys").should eq([:who]) end end + it 'supports a default value' do + evaluate("who", 12).should eq(12) + evaluate("who", nil).should be_nil + end + + it 'supports a default value through a Proc' do + evaluate("who"){ 12 }.should eq(12) + evaluate("who"){ nil }.should be_nil + end + it 'raises a NameError when not found' do lambda{ evaluate("who") }.should raise_error(NameError) end end # describe Dialect, 'evaluate'