@@ -2481,7 +2481,6 @@ def test_unpack
24812481 i & integer\\
24822482 L & unsigned long\\
24832483 l & long\\
2484-
24852484 m & string encoded in base64 (uuencoded)\\
24862485 N & long, network (big-endian) byte order\\
24872486 n & short, network (big-endian) byte-order\\
@@ -2493,8 +2492,7 @@ def test_unpack
24932492 v & short, little-endian byte order\\
24942493 X & back up a byte\\
24952494 x & null byte\\
2496- Z & ASCII string (null padded, count is width)\\
2497- "
2495+ Z & ASCII string (null padded, count is width)\\"
24982496=end
24992497 end
25002498
@@ -2845,13 +2843,15 @@ def test_substr_negative_begin
28452843 assert_equal ( "\u3042 " , ( "\u3042 " * 100 ) [ -1 ] )
28462844 end
28472845
2848- =begin
28492846 def test_compare_different_encoding_string
28502847 s1 = S ( "\xff " . force_encoding ( "UTF-8" ) )
28512848 s2 = S ( "\xff " . force_encoding ( "ISO-2022-JP" ) )
28522849 assert_equal ( [ -1 , 1 ] , [ s1 <=> s2 , s2 <=> s1 ] . sort )
2850+
2851+ s3 = S ( "あ" . force_encoding ( "UTF-16LE" ) )
2852+ s4 = S ( "a" . force_encoding ( "IBM437" ) )
2853+ assert_equal ( [ -1 , 1 ] , [ s3 <=> s4 , s4 <=> s3 ] . sort )
28532854 end
2854- =end
28552855
28562856 def test_casecmp
28572857 assert_equal ( 0 , S ( "FoO" ) . casecmp ( "fOO" ) )
@@ -2953,7 +2953,6 @@ def test_lstrip_bang
29532953 s5 = S ( "\u0000 \u3042 " )
29542954 assert_equal ( "\u3042 " , s5 . lstrip! )
29552955 assert_equal ( "\u3042 " , s5 )
2956-
29572956 end
29582957
29592958 def test_delete_prefix_type_error
@@ -3321,6 +3320,11 @@ def test_byteslice
33213320
33223321 assert_equal ( u ( "\x82 " ) +( "\u3042 " *9 ) , S ( "\u3042 " *10 ) . byteslice ( 2 , 28 ) )
33233322
3323+ assert_equal ( "\xE3 " , S ( "こんにちは" ) . byteslice ( 0 ) )
3324+ assert_equal ( "こんにちは" , S ( "こんにちは" ) . byteslice ( 0 , 15 ) )
3325+ assert_equal ( "こ" , S ( "こんにちは" ) . byteslice ( 0 , 3 ) )
3326+ assert_equal ( "は" , S ( "こんにちは" ) . byteslice ( 12 , 15 ) )
3327+
33243328 bug7954 = '[ruby-dev:47108]'
33253329 assert_equal ( false , S ( "\u3042 " ) . byteslice ( 0 , 2 ) . valid_encoding? , bug7954 )
33263330 assert_equal ( false , ( "\u3042 " *10 ) . byteslice ( 0 , 20 ) . valid_encoding? , bug7954 )
0 commit comments