diff options
| author | Yukihiro Matz Matsumoto <[email protected]> | 2013-03-09 00:39:45 +0900 |
|---|---|---|
| committer | Yukihiro Matz Matsumoto <[email protected]> | 2013-03-09 00:39:45 +0900 |
| commit | b783311ec442d4b27f67ecb287c413cac36df147 (patch) | |
| tree | 8f90cb67e53f2b949cd62b515dce981806f6a2e9 /mrbgems/mruby-string-ext/test | |
| parent | 318ad9c802d010b398a9683407716b5c7ef32b00 (diff) | |
| parent | 3c5bf780e4a3dcd2e73edd2475140ce0c2a46268 (diff) | |
| download | mruby-b783311ec442d4b27f67ecb287c413cac36df147.tar.gz mruby-b783311ec442d4b27f67ecb287c413cac36df147.zip | |
Merge branch 'master' of github.com:mruby/mruby
Diffstat (limited to 'mrbgems/mruby-string-ext/test')
| -rw-r--r-- | mrbgems/mruby-string-ext/test/string.rb | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/mrbgems/mruby-string-ext/test/string.rb b/mrbgems/mruby-string-ext/test/string.rb index d61ece351..eaff81890 100644 --- a/mrbgems/mruby-string-ext/test/string.rb +++ b/mrbgems/mruby-string-ext/test/string.rb @@ -16,3 +16,57 @@ end assert('String#dump') do "foo".dump == "\"foo\"" end + +assert('String#strip') do + s = " abc " + s.strip + "".strip == "" and " \t\r\n\f\v".strip == "" and + "\0a\0".strip == "\0a" and + "abc".strip == "abc" and + " abc".strip == "abc" and + "abc ".strip == "abc" and + " abc ".strip == "abc" and + s == " abc " +end + +assert('String#lstrip') do + s = " abc " + s.lstrip + "".lstrip == "" and " \t\r\n\f\v".lstrip == "" and + "\0a\0".lstrip == "\0a\0" and + "abc".lstrip == "abc" and + " abc".lstrip == "abc" and + "abc ".lstrip == "abc " and + " abc ".lstrip == "abc " and + s == " abc " +end + +assert('String#rstrip') do + s = " abc " + s.rstrip + "".rstrip == "" and " \t\r\n\f\v".rstrip == "" and + "\0a\0".rstrip == "\0a" and + "abc".rstrip == "abc" and + " abc".rstrip == " abc" and + "abc ".rstrip == "abc" and + " abc ".rstrip == " abc" and + s == " abc " +end + +assert('String#strip!') do + s = " abc " + t = "abc" + s.strip! == "abc" and s == "abc" and t.strip! == nil +end + +assert('String#lstrip!') do + s = " abc " + t = "abc " + s.lstrip! == "abc " and s == "abc " and t.lstrip! == nil +end + +assert('String#rstrip!') do + s = " abc " + t = " abc" + s.rstrip! == " abc" and s == " abc" and t.rstrip! == nil +end |
