Sha256: fc8bdd3c3794ae6105b821599be8221464bc714b94deea6a58c47cc24a0fce58

Contents?: true

Size: 737 Bytes

Versions: 1

Compression:

Stored size: 737 Bytes

Contents

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

    subject{
      Syntax.parse(input, root: "set_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(SetType)
          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([
          :set_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_set_type.rb