spec/expressive_spec.rb in expressive-0.0.36 vs spec/expressive_spec.rb in expressive-0.0.37

- 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 $sub get put post >= > < <= and or if date datetime lookup round $round $days_ago $hours_ago $minutes_ago $append $id $head $lookup $reverse $tail $hash $concat $split $sms $hval $index $random $join $not $include $string $float $integer) } + it { Expressive.all_symbols.should =~ %w(+ - * / = ~ set sum $sub get put post >= > < <= and or if date datetime lookup round $round $days_ago $hours_ago $minutes_ago $append $id $head $lookup $reverse $tail $hash $concat $split $sms $hval $index $random $join $not $include $string $float $integer) } end describe "understands booleans" do it { Expressive.run("true").should eql true } it { Expressive.run("false").should eql false } @@ -91,9 +91,16 @@ 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 regex" do + it { Expressive.run('(~ "asdf" "as.f")').should eql true} + it { Expressive.run('(~ "asdf" "asdf.")').should eql false} + it { Expressive.run('(~ "asdf" "^asdf$")').should eql true} + it { Expressive.run('(~ "asdf" "$sdf")').should eql false} end describe "understands list operations" do it { Expressive.run("($head (1 2 3))").should eql 1 } it { Expressive.run("($include 3 (1 2 3))").should eql true }