Sha256: 5525d26d59176ae91ffe27235a6f39a95a9cbfbba7c81eb9a0f670b0af1fd912

Contents?: true

Size: 808 Bytes

Versions: 9

Compression:

Stored size: 808 Bytes

Contents

require 'spec_helper'
module Finitio
  describe Type, "suppremum" do

    subject{
      left.suppremum(right)
    }

    let(:left){
      intType
    }

    context 'when both are equal' do
      let(:right){
        intType
      }

      it 'works' do
        expect(subject).to be(left)
      end
    end

    context 'when they are different' do
      let(:right){
        nilType
      }

      it 'works' do
        expect(subject).to be_a(UnionType)
        expect(subject.candidates).to eql([left, right])
      end
    end

    context 'when one is any' do
      let(:right){
        anyType
      }

      it 'works' do
        expect(subject).to eql(anyType)
      end

      it 'works the other way round' do
        expect(anyType.suppremum(left)).to eql(anyType)
      end
    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
finitio-0.12.0 spec/type/test_suppremum.rb
finitio-0.11.4 spec/type/test_suppremum.rb
finitio-0.11.3 spec/type/test_suppremum.rb
finitio-0.11.2 spec/type/test_suppremum.rb
finitio-0.11.1 spec/type/test_suppremum.rb
finitio-0.10.0 spec/type/test_suppremum.rb
finitio-0.9.1 spec/type/test_suppremum.rb
finitio-0.9.0 spec/type/test_suppremum.rb
finitio-0.8.0 spec/type/test_suppremum.rb