lib/vex/base/string/string_ext.rb in vex-0.2 vs lib/vex/base/string/string_ext.rb in vex-0.2.1
- old
+ new
@@ -2,11 +2,19 @@
def constantize?
constantize
rescue LoadError, NameError
STDERR.puts $!.to_s
end
+
+ def upcase?
+ self == upcase
+ end
+ def downcase?
+ self == downcase
+ end
+
def uri?
!!(self =~ /^[a-z][a-z]+:/)
end
def unhtml
@@ -131,6 +139,20 @@
def test_constantize
assert_equal String, "String".constantize?
assert_equal nil, "I::Dont::Know::This".constantize?
end
+
+ def test_downcase
+ assert_equal true, "expected".downcase?
+ assert_equal false, "Expected".downcase?
+ assert_equal false, "EXPECTED".downcase?
+
+ assert_equal false, "expected".upcase?
+ assert_equal false, "Expected".upcase?
+ assert_equal true, "EXPECTED".upcase?
+
+ assert_equal true, "".upcase?
+ assert_equal true, "".downcase?
+ end
+
end if VEX_TEST == "base"