Sha256: e217f24f74f47f14e4f8b71252780690f4d1b2752bc3ffa59895d611efc17b1c
Contents?: true
Size: 1.45 KB
Versions: 19
Compression:
Stored size: 1.45 KB
Contents
# Test for facets/string/bracket require 'facets/string/bracket.rb' require 'test/unit' class TestStringBracket < Test::Unit::TestCase def test_bracket assert_equal( '#X#', 'X'.bracket('#') ) assert_equal( 'xX!', 'X'.bracket('x','!') ) assert_equal( '{X}', 'X'.bracket('{','}') ) assert_equal( '<X>', 'X'.bracket('<') ) assert_equal( '(X)', 'X'.bracket('(') ) assert_equal( '[X]', 'X'.bracket('[') ) assert_equal( '{X}', 'X'.bracket('{') ) end def test_braket! a = 'X' ; a.bracket!('#') assert_equal( '#X#', a ) a = 'X' ; a.bracket!('x','!') assert_equal( 'xX!', a ) a = 'X' ; a.bracket!('{','}') assert_equal( '{X}', a ) a = 'X' ; a.bracket!('<') assert_equal( '<X>', a ) a = 'X' ; a.bracket!('(') assert_equal( '(X)', a ) a = 'X' ; a.bracket!('[') assert_equal( '[X]', a ) a = 'X' ; a.bracket!('{') assert_equal( '{X}', a ) end def test_quote_01 a = "hi" assert_raises( ArgumentError ) { a.quote(1,2) } end def test_quote_02 a = "hi" assert_equal( %{'hi'}, a.quote ) end def test_quote_03 a = "hi" assert_equal( %{"hi"}, a.quote(:d) ) assert_equal( %{"hi"}, a.quote(:double) ) end def test_quote_04 a = "hi" assert_equal( %{'hi'}, a.quote(:s) ) assert_equal( %{'hi'}, a.quote(:single) ) end def test_quote_05 a = "hi" assert_equal( %{`hi`}, a.quote(:b) ) assert_equal( %{`hi`}, a.quote(:back) ) end end
Version data entries
19 entries across 19 versions & 1 rubygems