Sha256: 4d223a4abda0ef897eafd9dcc219b96f2420cc7fccfe86c43be9842d0d1d3d3b
Contents?: true
Size: 842 Bytes
Versions: 2
Compression:
Stored size: 842 Bytes
Contents
require 'spec_helper' module Finitio describe Syntax, "unnamed_constraint" do subject{ Syntax.parse(input, root: "unnamed_constraint") } let(:compiled){ subject.compile("a") } let(:ast){ subject.to_ast("a") } context 'a >= 10' do let(:input){ 'a >= 10' } it 'compiles to an Hash' do compiled.should be_a(Hash) end it 'has expected keys' do compiled.keys.should eq([:predicate]) end it 'should be the correct Proc' do compiled[:predicate].call(12).should be_true compiled[:predicate].call(9).should be_false end it 'has the expected AST' do ast.should eq([ :constraint, "default", [:fn, [:parameters, "a"], [:source, "a >= 10"]] ]) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
finitio-0.4.1 | spec/unit/syntax/nodes/test_unnamed_constraint.rb |
finitio-0.4.0 | spec/unit/syntax/nodes/test_unnamed_constraint.rb |