Sha256: 2510fb7e8c3031893a724da0fa33a3e893446938e98e31770bacf454f1a11973
Contents?: true
Size: 1.4 KB
Versions: 2
Compression:
Stored size: 1.4 KB
Contents
# # File:: test_StringFormatting.rb # Author:: wkm # Copyright:: 2009 # License:: GPL # # Unit tests for String#cabbrev, String#labbrev, and String#rabbrev # methods. The main thing these look for is off-by-one errors. # $:.unshift File.join(File.dirname(__FILE__),'..','lib') require 'test/unit' require 'sitefuel/extensions/StringFormatting' class TestString < Test::Unit::TestCase def test_cabbrev assert_equal "hello world", "hello world".cabbrev(11) assert_equal "hello world", "hello world".cabbrev(12) assert_equal 12, "the quick brown fox jumped over the lazy dog".cabbrev(12).length assert_equal "the q... dog", "the quick brown fox jumped over the lazy dog".cabbrev(12) assert_equal "the quick brown fox... over the lazy dog", "the quick brown fox jumped over the lazy dog".cabbrev(40) end def test_rabbrev assert_equal "foo", "foo".rabbrev(12) assert_equal "...brown dog", "the quick brown dog".rabbrev(12) assert_equal 12, "the quick brown dog".rabbrev(12).length end def test_labbrev assert_equal "foo", "foo".labbrev(12) assert_equal "the quick...", "the quick brown dog".labbrev(12) assert_equal 12, "the quick brown dog".labbrev(12).length end def test_align assert_equal( "hi\n hello world\nyup there\n it is!\n", %q{ hi hello world yup there it is! }.align ) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sitefuel-0.0.0b | test/test_StringFormatting.rb |
sitefuel-0.0.0a | test/test_StringFormatting.rb |