Sha256: 3594bb2cc29f69bc5434f442797d9828e27df686fc9531bb885a585d6d4b57cc

Contents?: true

Size: 674 Bytes

Versions: 2

Compression:

Stored size: 674 Bytes

Contents

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

    subject{
      Syntax.parse(source, root: "builtin_type")
    }

    let(:compiled){
      subject.compile(type_factory)
    }

    context 'when an unqualified class name' do
      let(:source){ ".Integer" }

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

    context 'when a qualified class name' do
      let(:source){ ".Qrb::Type" }

      it 'compiles to a BuiltinType' do
        compiled.should be_a(BuiltinType)
        compiled.ruby_type.should be(::Qrb::Type)
      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_builtin_type.rb
qrb-0.1.0 spec/unit/syntax/nodes/test_builtin_type.rb