| | 50 | |
| | 51 | |
| | 52 | def test_string_length |
| | 53 | assert_equal 3, "ABC".length |
| | 54 | end |
| | 55 | |
| | 56 | def test_multibyte_string_length_utf8 |
| | 57 | assert_equal 3, NKF.nkf("-Ww", "あいう").length |
| | 58 | end |
| | 59 | |
| | 60 | def test_multibyte_string_length_sjis |
| | 61 | assert_equal 3, NKF.nkf("-Ws", "あいう").length |
| | 62 | end |
| | 63 | |
| | 64 | |
| | 65 | def test_string_substring |
| | 66 | assert_equal "BCD", "ABCDE"[1...4] |
| | 67 | end |
| | 68 | |
| | 69 | def test_multibyte_string_substring_utf8 |
| | 70 | assert_equal NKF.nkf("-Ww", "いうえ"), NKF.nkf("-Ww", "あいうえお")[1...4] |
| | 71 | end |
| | 72 | |
| | 73 | def test_multibyte_string_substring_usjis |
| | 74 | assert_equal NKF.nkf("-Ws", "いうえ"), NKF.nkf("-Ws", "あいうえお")[1...4] |
| | 75 | end |