diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-06-16 11:35:42 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-06-16 11:35:42 +0900 |
| commit | a7770a39aa4d59fd4fc973b42b9faa2a2b1cbd73 (patch) | |
| tree | 726022fb5872384eaf0a3003d99ab9b346cc9f9c /mrbgems/mruby-string-ext/test/string.rb | |
| parent | d4d99dd6d7e1374af3e567b175035b36977337c4 (diff) | |
| parent | 4d9ca27ba6d44e7df56c02e240cc8795933072e5 (diff) | |
| download | mruby-a7770a39aa4d59fd4fc973b42b9faa2a2b1cbd73.tar.gz mruby-a7770a39aa4d59fd4fc973b42b9faa2a2b1cbd73.zip | |
Merge branch 'string-upto' of https://github.com/ksss/mruby into ksss-string-upto
Diffstat (limited to 'mrbgems/mruby-string-ext/test/string.rb')
| -rw-r--r-- | mrbgems/mruby-string-ext/test/string.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/mrbgems/mruby-string-ext/test/string.rb b/mrbgems/mruby-string-ext/test/string.rb index da39bd8e9..2a568c7d6 100644 --- a/mrbgems/mruby-string-ext/test/string.rb +++ b/mrbgems/mruby-string-ext/test/string.rb @@ -495,6 +495,17 @@ assert('String#rjust should raise on zero width padding') do end assert('String#upto') do + assert_equal %w(a8 a9 b0 b1 b2 b3 b4 b5 b6), "a8".upto("b6").to_a + assert_equal ["9", "10", "11"], "9".upto("11").to_a + assert_equal [], "25".upto("5").to_a + assert_equal ["07", "08", "09", "10", "11"], "07".upto("11").to_a + +if UTF8STRING + assert_equal ["あ", "ぃ", "い", "ぅ", "う", "ぇ", "え", "ぉ", "お"], "あ".upto("お").to_a +end + + assert_equal ["9", ":", ";", "<", "=", ">", "?", "@", "A"], "9".upto("A").to_a + a = "aa" start = "aa" count = 0 @@ -554,6 +565,8 @@ assert('String#upto') do count += 1 }) assert_equal(2, count) + + assert_raise(TypeError) { "a".upto(:c) {} } end assert('String#ord') do |
