Sha256: 760f665780d401453a091dd0af312df103019ed0c150de6bce0fdaf367ed7d8b

Contents?: true

Size: 845 Bytes

Versions: 2

Compression:

Stored size: 845 Bytes

Contents

require 'spec_helper'
module Qrb
  describe Syntax, "tuple_type" do

    subject{
      Syntax.parse(input, root: "tuple_type")
    }

    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
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
qrb-0.2.0 spec/unit/syntax/nodes/test_tuple_type.rb
qrb-0.1.0 spec/unit/syntax/nodes/test_tuple_type.rb