Sha256: fb8b5c2465486d0e1858c55f4a9327c882594a8afe3877c42833f6d25afc1df1
Contents?: true
Size: 821 Bytes
Versions: 2
Compression:
Stored size: 821 Bytes
Contents
require 'spec_helper' module Finitio describe Syntax, "named_constraint" do subject{ Syntax.parse(input, root: "named_constraint") } let(:compiled){ subject.compile("a") } let(:ast){ subject.to_ast('a') } context 'a >= 10' do let(:input){ 'foo: a >= 10' } it 'compiles to an Hash' do compiled.should be_a(Hash) end it 'has expected keys' do compiled.keys.should eq([:foo]) end it 'should be the correct Proc' do compiled[:foo].call(12).should be_true compiled[:foo].call(9).should be_false end it 'has the expected AST' do ast.should eq([ :constraint, "foo", [: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_named_constraint.rb |
finitio-0.4.0 | spec/unit/syntax/nodes/test_named_constraint.rb |