Sha256: 6adc8b6ac9323f9c0fe4966b382a69560054385980d316c557c12488a5d8c001

Contents?: true

Size: 741 Bytes

Versions: 2

Compression:

Stored size: 741 Bytes

Contents

require 'spec_helper'
module Finitio
  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

2 entries across 2 versions & 1 rubygems

Version Path
finitio-0.4.1 spec/unit/syntax/nodes/test_set_type.rb
finitio-0.4.0 spec/unit/syntax/nodes/test_set_type.rb