Sha256: 8802f43c241196bb1e7c2d77b04813560d961f31afe17e78b5e9563b2e743d6a

Contents?: true

Size: 912 Bytes

Versions: 90

Compression:

Stored size: 912 Bytes

Contents

require 'test_helper'
require 'tins'

module Tins
  class ExtractLastArgumentOptionsTest < Test::Unit::TestCase
    require 'tins/xt/extract_last_argument_options'

    def test_empty_argument_array
      arguments = []
      result = arguments.extract_last_argument_options
      assert_equal [ [], {} ], result
      assert_not_same arguments, result.first
    end

    def test_argument_array_without_options
      arguments = [ 1, 2, 3 ]
      result = arguments.extract_last_argument_options
      assert_equal [ [ 1, 2, 3 ], {} ], result
      assert_not_same arguments, result.first
    end

    def test_argument_array_witt_options
      arguments = [ 1, 2, 3, { foo: :bar } ]
      result = arguments.extract_last_argument_options
      assert_equal [ [ 1, 2, 3 ], { foo: :bar } ], result
      assert_not_same arguments, result.first
      assert_not_same arguments.last, result.last
    end
  end
end

Version data entries

90 entries across 77 versions & 4 rubygems

Version Path
tins-1.34.0 tests/extract_last_argument_options_test.rb
tins-1.33.0 tests/extract_last_argument_options_test.rb
tdiary-5.2.4 vendor/bundle/ruby/3.1.0/gems/tins-1.31.1/tests/extract_last_argument_options_test.rb
tins-1.32.1 tests/extract_last_argument_options_test.rb
tins-1.32.0 tests/extract_last_argument_options_test.rb
tdiary-5.2.3 vendor/bundle/ruby/3.1.0/gems/tins-1.31.1/tests/extract_last_argument_options_test.rb
tdiary-5.2.2 vendor/bundle/ruby/3.1.0/gems/tins-1.31.1/tests/extract_last_argument_options_test.rb
tins-1.31.1 tests/extract_last_argument_options_test.rb
tdiary-5.2.1 vendor/bundle/ruby/3.1.0/gems/tins-1.31.0/tests/extract_last_argument_options_test.rb
tins-1.31.0 tests/extract_last_argument_options_test.rb
tins-1.30.0 tests/extract_last_argument_options_test.rb
tdiary-5.2.0 vendor/bundle/ruby/3.0.0/gems/tins-1.29.1/tests/extract_last_argument_options_test.rb
tdiary-5.2.0 vendor/bundle/ruby/2.7.0/gems/tins-1.29.1/tests/extract_last_argument_options_test.rb
tdiary-5.1.7 vendor/bundle/ruby/2.7.0/gems/tins-1.29.1/tests/extract_last_argument_options_test.rb
tdiary-5.1.7 vendor/bundle/ruby/3.0.0/gems/tins-1.29.1/tests/extract_last_argument_options_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/extract_last_argument_options_test.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tins-1.28.0/tests/extract_last_argument_options_test.rb
tdiary-5.1.6 vendor/bundle/ruby/3.0.0/gems/tins-1.29.1/tests/extract_last_argument_options_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/extract_last_argument_options_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/extract_last_argument_options_test.rb