Sha256: 7aa80a4014ee2ef12777145358612a3a404012842b094cb39a14a289fb7546ee

Contents?: true

Size: 737 Bytes

Versions: 1

Compression:

Stored size: 737 Bytes

Contents

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

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

    describe "compilation result" do
      let(:compiled){
        subject.compile(type_factory)
      }

      context '[.Integer]' do
        let(:input){ '[.Integer]' }

        it 'compiles to a SeqType' do
          compiled.should be_a(SeqType)
          compiled.elm_type.should be_a(BuiltinType)
          compiled.elm_type.ruby_type.should be(Integer)
        end
      end
    end

    describe "AST" do
      let(:input){ '[.Integer]' }

      let(:ast){ subject.to_ast }

      it{ ast.should eq([
          :seq_type,
          [: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_seq_type.rb