Sha256: a054f69501b270ae35dc4906941a8f18cea4351b7ce9c29b63b177b5d43e4dd6

Contents?: true

Size: 929 Bytes

Versions: 10

Compression:

Stored size: 929 Bytes

Contents

require 'spec_helper'
module Finitio
  describe System, "check_and_warn" do

    before {
      Finitio.stdlib_path(Path.dir)
    }

    subject{
      Finitio.system(Path.dir/"fixtures/with-duplicates.fio").check_and_warn(logger)
    }

    let(:logger){
      TestLogger.new
    }

    it {
      should be_a(Finitio::System)
    }

    it 'detects duplicate types as expected' do
      subject
      expect(logger.infos).to eql([
        "Duplicate type def `NilClass`",
        "Duplicate type def `Posint`"
      ])
    end

    it 'detects type erasures as expected' do
      subject
      expect(logger.warns).to eql([
        "Type erasure `Negint`",
      ])
    end

    class TestLogger

      def initialize
        @warns = []
        @infos = []
      end
      attr_reader :warns, :infos

      def warn(msg)
        @warns << msg
      end

      def info(msg)
        @infos << msg
      end

    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
finitio-0.12.0 spec/system/test_check_and_warn.rb
finitio-0.11.4 spec/system/test_check_and_warn.rb
finitio-0.11.3 spec/system/test_check_and_warn.rb
finitio-0.11.2 spec/system/test_check_and_warn.rb
finitio-0.11.1 spec/system/test_check_and_warn.rb
finitio-0.10.0 spec/system/test_check_and_warn.rb
finitio-0.9.1 spec/system/test_check_and_warn.rb
finitio-0.9.0 spec/system/test_check_and_warn.rb
finitio-0.8.0 spec/system/test_check_and_warn.rb
finitio-0.7.0 spec/system/test_check_and_warn.rb