Sha256: fda99d63191293f1c5809a94b0b77e9a41bf732b8591a72f02732974083c1ba4

Contents?: true

Size: 1.23 KB

Versions: 4

Compression:

Stored size: 1.23 KB

Contents

require 'facets/string/expand_tab'
require 'test/unit'

class TC_String_Expand_Tab < Test::Unit::TestCase

  def setup
    @tabs = <<-EOF

\tOne tab
 \tOne space and one tab
    \t Six spaces, a tab, and a space
    EOF
  end  # def setup

  def test_expand_tabs_1
    expected = <<-EOF

        One tab
        One space and one tab
         Six spaces, a tab, and a space
    EOF
    assert_equal(expected, @tabs.expand_tabs)
    assert_equal(expected, @tabs.expand_tabs(8))
  end

  def test_expand_tabs_2
    expected = <<-EOF

    One tab
    One space and one tab
         Six spaces, a tab, and a space
    EOF
    assert_equal(expected, @tabs.expand_tabs(4))
  end

  def test_expand_tabs_3
    expected = <<-EOF

                One tab
                One space and one tab
                 Six spaces, a tab, and a space
    EOF
    assert_equal(expected, @tabs.expand_tabs(16))
  end

  def test_expand_tabs_4
    expected = <<-EOF

 One tab
  One space and one tab
      Six spaces, a tab, and a space
    EOF
    assert_equal(expected, @tabs.expand_tabs(1))
  end

  def test_expand_tabs_5
    expected = <<-EOF

One tab
 One space and one tab
     Six spaces, a tab, and a space
    EOF
    assert_equal(expected, @tabs.expand_tabs(0))
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
facets-2.8.4 test/core/string/test_expand_tabs.rb
facets-2.8.3 test/core/string/test_expand_tabs.rb
facets-2.8.2 test/core/string/test_expand_tabs.rb
facets-2.8.1 test/core/string/test_expand_tabs.rb