summaryrefslogtreecommitdiff
path: root/test/scanners/ruby/operators.in.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/scanners/ruby/operators.in.rb')
-rw-r--r--test/scanners/ruby/operators.in.rb51
1 files changed, 51 insertions, 0 deletions
diff --git a/test/scanners/ruby/operators.in.rb b/test/scanners/ruby/operators.in.rb
new file mode 100644
index 0000000..8fa7090
--- /dev/null
+++ b/test/scanners/ruby/operators.in.rb
@@ -0,0 +1,51 @@
+class Feeling
+
+ def ~
+ p :drunk
+ end
+
+ def !
+ p :alert
+ end
+
+ alias not !@
+ alias tilde ~@
+
+ def -@
+ p :bad
+ end
+
+ def +@
+ p :good
+ end
+
+end
+
+feeling = Feeling.new
+
+-feeling # => :bad
++feeling # => :good
+!feeling # => :alert
+~feeling # => :drunk
+
+def =~ other
+ bla
+end
+
+feeling.! # => :alert
+feeling.~ # => :drunk
+feeling.!@ # => :alert
+feeling.~@ # => :drunk
+feeling.-@() # => :bad
+feeling.+@() # => :good
+
+# >> :bad
+# >> :good
+# >> :alert
+# >> :drunk
+# >> :alert
+# >> :drunk
+# >> :alert
+# >> :drunk
+# >> :bad
+# >> :good