Sha256: ca9a9a201c5e623e2495a6422924ce992e9501796c744510a29750b81854ae7b

Contents?: true

Size: 831 Bytes

Versions: 1

Compression:

Stored size: 831 Bytes

Contents

#  _____         _
# |_   _|__  ___| |_
#   | |/ _ \/ __| __|
#   | |  __/\__ \ |_
#   |_|\___||___/\__|
#
# for lib/facets/core/string/last.rb
#
# Extracted Tue Jul 25 10:07:15 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.7.0 test/lib/facets/core/string/test_last.rb