Sha256: 4991f3831d2ab5d6e5fe5eb31dcd278b8a299c5aea003a692278ddbee125fce3
Contents?: true
Size: 1.23 KB
Versions: 1
Compression:
Stored size: 1.23 KB
Contents
require 'spec_helper' module Qrb describe Syntax, "relation_type" do subject{ Syntax.parse(input, root: "relation_type") } describe "compilation result" do let(:compiled){ subject.compile(type_factory) } context 'empty heading' do let(:input){ '{{ }}' } it 'compiles to a RelationType' do compiled.should be_a(RelationType) compiled.heading.should be_empty end end context '{{a: .Integer}}' do let(:input){ '{{a: .Integer}}' } it 'compiles to a RelationType' do compiled.should be_a(RelationType) compiled.heading.size.should eq(1) end end context '{{a: .Integer, b: .Float}}' do let(:input){ '{{a: .Integer, b: .Float}}' } it 'compiles to a RelationType' do compiled.should be_a(RelationType) compiled.heading.size.should eq(2) end end end describe "AST" do let(:input){ '{{a: .Integer}}' } let(:ast){ subject.to_ast } it{ ast.should eq([ :relation_type, [ :heading, [ :attribute, "a", [:builtin_type, "Integer" ]] ] ]) } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
qrb-0.3.0 | spec/unit/syntax/nodes/test_relation_type.rb |