spec/expressive_spec.rb in expressive-0.0.18 vs spec/expressive_spec.rb in expressive-0.0.20
- old
+ new
@@ -4,11 +4,11 @@
before(:each) do
@scope = Expressive::TopLevel.new
end
describe "all_symbols" do
- it { Expressive.all_symbols.should =~ %w(+ - * / = set sum get put post >= > < <= and or if date lookup round $days_ago $hours_ago $minutes_ago $append $id) }
+ it { Expressive.all_symbols.should =~ %w(+ - * / = set sum get put post >= > < <= and or if date lookup round $days_ago $hours_ago $minutes_ago $append $id $head $lookup $reverse $tail) }
end
describe "understands booleans" do
it { Expressive.run("true").should eql true }
it { Expressive.run("false").should eql false }
@@ -49,9 +49,15 @@
it { Expressive.run("(> 2 4)").should eql false }
it { Expressive.run("(< 4 2)").should eql false }
it { Expressive.run("(< 2 4)").should eql true }
it { Expressive.run("(>= 4 4)").should eql true }
it { Expressive.run("(<= 4 4)").should eql true }
+ end
+
+ describe "understands list operations" do
+ it { Expressive.run("($head (1 2 3))").should eql 1 }
+ it { Expressive.run("($tail (1 2 3))").should eql [2, 3] }
+ it { Expressive.run("($reverse (1 2 3))").should eql [3 ,2 ,1] }
end
describe "understands compound statements" do
it { Expressive.run("(= (+ 4 2) 6)").should eql true }
it { Expressive.run("(if (and (< 3 9) (> 2 1)), true, false)").should eql true }