Sha256: 7e0b4ae63fba3a3ecd1046a371600de69ca7131e873f2fbc732c2b8db54ee65a

Contents?: true

Size: 837 Bytes

Versions: 1

Compression:

Stored size: 837 Bytes

Contents

# -*- coding: utf-8 -*-
require "sixarm_ruby_ramp_test"
require "sixarm_ruby_ramp/array/join"

class ArrayJoinTest < Minitest::Test

  A=['a','b','c']

  def test_join_with_no_ops
    assert_equal('abc',A.join())
  end

  def test_join_with_1_op_does_infix
    assert_equal('a*b*c', A.join('*'))
  end

  def test_join_with_2_ops_does_prefix_suffix
    assert_equal('[a][b][c]', A.join('[',']'))
  end

  def test_join_with_3_ops_does_prefix_suffix_infix
    assert_equal('[a]*[b]*[c]', A.join('[',']','*'))
  end

  def test_join_with_too_many_ops_raises
    assert_raises(ArgumentError){ A.join('','','','') }
  end

  def test_join_prefix_suffix
    assert_equal('[a][b][c]', A.join_prefix_suffix('[',']'))
  end

  def test_join_prefix_suffix_infix
    assert_equal('[a]*[b]*[c]', A.join_prefix_suffix_infix('[',']','*'))
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sixarm_ruby_ramp-4.2.4 test/sixarm_ruby_ramp_test/array/join_test.rb