Sha256: 9c62d885af6046687898f88b854b074fa01e44ee50993671309d227b9a395a19

Contents?: true

Size: 831 Bytes

Versions: 1

Compression:

Stored size: 831 Bytes

Contents

#  _____         _
# |_   _|__  ___| |_
#   | |/ _ \/ __| __|
#   | |  __/\__ \ |_
#   |_|\___||___/\__|
#
# for lib/facets/core/string/last.rb
#
# Extracted Mon Jun 05 08:14:29 EDT 2006
# Unit Tools Reap Test Extractor
#

require 'facets/core/string/last.rb'


  require 'test/unit'

  class TCString < Test::Unit::TestCase

    def test_last
      assert_equal( "z", "abcxyz".last )
      assert_equal( "cz", "ax by cz".last(' ') )
      assert_equal( "c", "a\nb\nc".last("\n") )
    end

    def test_last_eq
      s = "abc"
      s.last = "123"
      assert_equal( "abc123", s )
      s = "a\nbc"
      s.last = "123"
      assert_equal( "a\nbc123", s )
    end

    def test_last!
      s = "abc"
      s.last!
      assert_equal( "ab", s )
      s = "a b c"
      s.last!(' ')
      assert_equal( "a b", s )
    end

  end


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
facets-1.4.0 test/lib/facets/core/string/test_last.rb