Sha256: dd77e5ea41128924c937f1d8941d0e08f74b334393b5aefb3b33c09c0ea60050

Contents?: true

Size: 772 Bytes

Versions: 16

Compression:

Stored size: 772 Bytes

Contents

require 'epitools/semantic_version'

describe SemanticVersion do

  it "works" do
    [
      ["3.1.3pre1", "3.1.3-1", -1],
      ["1.15.10+54+g1ed124ace-1", "1.15.10-1", 1],
      ["0.30+2+gc0620e4-1", "0.30pre1", 1],
      ["1:0.27.2-1", "1:0.27.2-2", -1],
      ["0+337-2", "1", -1],
      # ["1.0", "1", 0], # <- fix this
      ["1.0", "1.0", 0],
      ["2:1.11-1", "1.9.4-1", 1],
    ].each do |a,b,target|
      result = SemanticVersion.compare(a,b)

      result.should == target

      case target
      when -1
        SemanticVersion.new(a).should be < SemanticVersion.new(b)
      when 1
        SemanticVersion.new(a).should be > SemanticVersion.new(b)
      when 0
        SemanticVersion.new(a).should == SemanticVersion.new(b)
      end
    end
  end

end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
epitools-0.5.136 spec/semantic_version_spec.rb
epitools-0.5.134 spec/semantic_version_spec.rb
epitools-0.5.133 spec/semantic_version_spec.rb
epitools-0.5.131 spec/semantic_version_spec.rb
epitools-0.5.130 spec/semantic_version_spec.rb
epitools-0.5.129 spec/semantic_version_spec.rb
epitools-0.5.128 spec/semantic_version_spec.rb
epitools-0.5.126 spec/semantic_version_spec.rb
epitools-0.5.125 spec/semantic_version_spec.rb
epitools-0.5.124 spec/semantic_version_spec.rb
epitools-0.5.123 spec/semantic_version_spec.rb
epitools-0.5.122 spec/semantic_version_spec.rb
epitools-0.5.121 spec/semantic_version_spec.rb
epitools-0.5.119 spec/semantic_version_spec.rb
epitools-0.5.118 spec/semantic_version_spec.rb
epitools-0.5.116 spec/semantic_version_spec.rb