Sha256: 02806eb1dc395e0e28a36f3292bfdd07d98d1082c8ebe61bb3048dd1d8079df7

Contents?: true

Size: 1.48 KB

Versions: 87

Compression:

Stored size: 1.48 KB

Contents

require 'test_helper'
require 'tins'

module Tins
  class StringVersionTest < Test::Unit::TestCase
    def test_comparison
      assert_operator '1.2'.version, :<, '1.3'.version
      assert_operator '1.3'.version, :>, '1.2'.version
      assert_operator '1.2'.version, :<=, '1.2'.version
      assert_operator '1.2'.version, :>=, '1.2'.version
      assert_operator '1.2'.version, :==, '1.2'.version
    end

    def test_change
      s = '1.2'
      s.version.revision = 1
      assert_equal '1.2.0.1', s
      s.version.revision += 1
      assert_equal '1.2.0.2', s
      s.version.succ!
      assert_equal '1.2.0.3', s
      s.version.pred!
      assert_equal '1.2.0.2', s
      assert_raise(ArgumentError) { s.version.build -= 1 }
      s.version.major = 2
      assert_equal '2.2.0.2', s
      s.version.minor = 1
      assert_equal '2.1.0.2', s
    end

    def test_bump
      s = '1.2.3'
      assert_equal '2.0.0', s.version.bump(:major).to_s
      s = '1.2.3'
      assert_equal '1.3.0', s.version.bump(:minor).to_s
      s = '1.2.3'
      assert_equal '1.2.4', s.version.bump(:build).to_s
      s = '1.2.3'
      assert_equal '1.2.4', s.version.bump.to_s
    end

    def test_dup
      s = '1.2.3'
      v = s.version
      w = v.dup
      v.succ!
      assert_equal '1.2.4', v.to_s
      assert_equal '1.2.3', w.to_s
    end

    def test_clone
      s = '1.2.3'
      v = s.version
      w = v.clone
      v.succ!
      assert_equal '1.2.4', v.to_s
      assert_equal '1.2.3', w.to_s
    end
  end
end

Version data entries

87 entries across 74 versions & 4 rubygems

Version Path
tins-1.34.0 tests/string_version_test.rb
tins-1.33.0 tests/string_version_test.rb
tdiary-5.2.4 vendor/bundle/ruby/3.1.0/gems/tins-1.31.1/tests/string_version_test.rb
tins-1.32.1 tests/string_version_test.rb
tins-1.32.0 tests/string_version_test.rb
tdiary-5.2.3 vendor/bundle/ruby/3.1.0/gems/tins-1.31.1/tests/string_version_test.rb
tdiary-5.2.2 vendor/bundle/ruby/3.1.0/gems/tins-1.31.1/tests/string_version_test.rb
tins-1.31.1 tests/string_version_test.rb
tdiary-5.2.1 vendor/bundle/ruby/3.1.0/gems/tins-1.31.0/tests/string_version_test.rb
tins-1.31.0 tests/string_version_test.rb
tins-1.30.0 tests/string_version_test.rb
tdiary-5.2.0 vendor/bundle/ruby/3.0.0/gems/tins-1.29.1/tests/string_version_test.rb
tdiary-5.2.0 vendor/bundle/ruby/2.7.0/gems/tins-1.29.1/tests/string_version_test.rb
tdiary-5.1.7 vendor/bundle/ruby/2.7.0/gems/tins-1.29.1/tests/string_version_test.rb
tdiary-5.1.7 vendor/bundle/ruby/3.0.0/gems/tins-1.29.1/tests/string_version_test.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tins-1.26.0/tests/string_version_test.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tins-1.28.0/tests/string_version_test.rb
tdiary-5.1.6 vendor/bundle/ruby/3.0.0/gems/tins-1.29.1/tests/string_version_test.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/2.7.0/gems/tins-1.28.0/tests/string_version_test.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/tins-1.26.0/tests/string_version_test.rb