Commit e3b339be authored by KOBAYASHI Shuji's avatar KOBAYASHI Shuji

Fix missing assertions in `mruby-string-ext` test

parent 46e45245
......@@ -33,62 +33,72 @@ assert('String#byteslice') do
end
assert('String#dump') do
("\1" * 100).dump # should not raise an exception - regress #1210
"\0".inspect == "\"\\000\"" and
"foo".dump == "\"foo\""
assert_equal("\"\\x00\"", "\0".dump)
assert_equal("\"foo\"", "foo".dump)
assert_nothing_raised { ("\1" * 100).dump } # regress #1210
end
assert('String#strip') do
s = " abc "
"".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 "
assert_equal("abc", s.strip)
assert_equal(" abc ", s)
assert_equal("", "".strip)
assert_equal("", " \t\r\n\f\v".strip)
assert_equal("\0a", "\0a\0".strip)
assert_equal("abc", "abc".strip)
assert_equal("abc", " abc".strip)
assert_equal("abc", "abc ".strip)
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 "
assert_equal("abc ", s.lstrip)
assert_equal(" abc ", s)
assert_equal("", "".lstrip)
assert_equal("", " \t\r\n\f\v".lstrip)
assert_equal("\0a\0", "\0a\0".lstrip)
assert_equal("abc", "abc".lstrip)
assert_equal("abc", " abc".lstrip)
assert_equal("abc ", "abc ".lstrip)
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 "
assert_equal(" abc", s.rstrip)
assert_equal(" abc ", s)
assert_equal("", "".rstrip)
assert_equal("", " \t\r\n\f\v".rstrip)
assert_equal("\0a", "\0a\0".rstrip)
assert_equal("abc", "abc".rstrip)
assert_equal(" abc", " abc".rstrip)
assert_equal("abc", "abc ".rstrip)
end
assert('String#strip!') do
s = " abc "
t = "abc"
s.strip! == "abc" and s == "abc" and t.strip! == nil
assert_equal("abc", s.strip!)
assert_equal("abc", s)
assert_nil(t.strip!)
assert_equal("abc", t)
end
assert('String#lstrip!') do
s = " abc "
t = "abc "
s.lstrip! == "abc " and s == "abc " and t.lstrip! == nil
assert_equal("abc ", s.lstrip!)
assert_equal("abc ", s)
assert_nil(t.lstrip!)
assert_equal("abc ", t)
end
assert('String#rstrip!') do
s = " abc "
t = " abc"
s.rstrip! == " abc" and s == " abc" and t.rstrip! == nil
assert_equal(" abc", s.rstrip!)
assert_equal(" abc", s)
assert_nil(t.rstrip!)
assert_equal(" abc", t)
end
assert('String#swapcase') do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment