diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-10-17 09:59:47 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-10-17 11:19:12 +0900 |
| commit | 332d8d2a1c12b098b28f8d06d2ed4bce42b09696 (patch) | |
| tree | 7dad8e5fca77e627fb454bb4b01a254093be0db0 /mrbgems/mruby-string-ext/test | |
| parent | 1519616ecb12fe9a121b83c32f74109cf2a5b533 (diff) | |
| download | mruby-332d8d2a1c12b098b28f8d06d2ed4bce42b09696.tar.gz mruby-332d8d2a1c12b098b28f8d06d2ed4bce42b09696.zip | |
Add `String#delete_{prefix,suffix}`; CRuby2.5
Diffstat (limited to 'mrbgems/mruby-string-ext/test')
| -rw-r--r-- | mrbgems/mruby-string-ext/test/string.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/mrbgems/mruby-string-ext/test/string.rb b/mrbgems/mruby-string-ext/test/string.rb index 2a568c7d6..b6146fb90 100644 --- a/mrbgems/mruby-string-ext/test/string.rb +++ b/mrbgems/mruby-string-ext/test/string.rb @@ -1,3 +1,4 @@ +# coding: utf-8 ## # String(Ext) Test @@ -665,3 +666,17 @@ assert('String#each_codepoint(UTF-8)') do end assert_equal expect, cp end if UTF8STRING + +assert('String#delete_prefix') do + assert_equal "llo", "hello".delete_prefix("he") + assert_equal "hello", "hello".delete_prefix("llo") + assert_equal "llo", "hello".delete_prefix!("he") + assert_nil "hello".delete_prefix!("llo") +end + +assert('String#delete_suffix') do + assert_equal "he", "hello".delete_suffix("llo") + assert_equal "hello", "hello".delete_suffix("he") + assert_equal "he", "hello".delete_suffix!("llo") + assert_nil "hello".delete_suffix!("he") +end |
