Sha256: 8bddd48d5a11e03b3492066a631e4b0633960a29c1b55f553191523b186653da
Contents?: true
Size: 1.2 KB
Versions: 1
Compression:
Stored size: 1.2 KB
Contents
require 'spec_helper' module Qrb describe Syntax, "tuple_type" do subject{ Syntax.parse(input, root: "tuple_type") } describe "compilation result" do let(:compiled){ subject.compile(type_factory) } context 'empty heading' do let(:input){ '{ }' } it 'compiles to a TupleType' do compiled.should be_a(TupleType) compiled.heading.should be_empty end end context '{a: .Integer}' do let(:input){ '{a: .Integer}' } it 'compiles to a TupleType' do compiled.should be_a(TupleType) compiled.heading.size.should eq(1) end end context '{a: .Integer, b: .Float}' do let(:input){ '{a: .Integer, b: .Float}' } it 'compiles to a TupleType' do compiled.should be_a(TupleType) 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([ :tuple_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_tuple_type.rb |