summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2014-01-09 22:04:01 -0800
committerYukihiro "Matz" Matsumoto <[email protected]>2014-01-09 22:04:01 -0800
commitff9b41cc371d7d5a75e58f62d01180787d21b327 (patch)
tree5b7c4adacbcdc1bb5ea709d4c0d088dbec094987 /test
parenta02eb4bddca5ed7906ba09441532f9ba1db25b79 (diff)
parent83413218a5f3681347128a491baebc5a21b0bc53 (diff)
downloadmruby-ff9b41cc371d7d5a75e58f62d01180787d21b327.tar.gz
mruby-ff9b41cc371d7d5a75e58f62d01180787d21b327.zip
Merge pull request #1654 from iij/pr-not-match-operator
add operator "!~".
Diffstat (limited to 'test')
-rw-r--r--test/t/kernel.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/t/kernel.rb b/test/t/kernel.rb
index 0f8fdebe4..e7c9c2635 100644
--- a/test/t/kernel.rb
+++ b/test/t/kernel.rb
@@ -479,6 +479,27 @@ assert('Kernel#!=') do
assert_false (str2 != str1)
end
+# operator "!~" is defined in ISO Ruby 11.4.4.
+assert('Kernel#!~') do
+ x = "x"
+ def x.=~(other)
+ other == "x"
+ end
+ assert_false x !~ "x"
+ assert_true x !~ "z"
+
+ y = "y"
+ def y.=~(other)
+ other == "y"
+ end
+ def y.!~(other)
+ other == "not y"
+ end
+ assert_false y !~ "y"
+ assert_false y !~ "z"
+ assert_true y !~ "not y"
+end
+
assert('Kernel#respond_to_missing?') do
class Test4RespondToMissing
def respond_to_missing?(method_name, include_private = false)