File tree Expand file tree Collapse file tree 2 files changed +10
-10
lines changed
ruby/ql/test/query-tests/variables Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change 11def test_basic ( x )
2- y = x #$ Alert
2+ y = x # $ Alert
33 y = x + 2
44 return y
55end
@@ -27,7 +27,7 @@ def m(x)
2727 print ( x + 1 )
2828 end
2929end
30-
30+
3131class Sub < Sup
3232 def m ( y )
3333 y = 3 # OK - the call to `super` sees the value of `y``
@@ -39,7 +39,7 @@ def do_twice
3939 yield
4040 yield
4141end
42-
42+
4343def get_done_twice x
4444 do_twice do
4545 print x
@@ -52,7 +52,7 @@ def retry_once
5252rescue
5353 yield
5454end
55-
55+
5656def get_retried x
5757 retry_once do
5858 print x
@@ -63,4 +63,4 @@ def get_retried x
6363 end
6464 end
6565 end
66- end
66+ end
Original file line number Diff line number Diff line change 99 m # reads local variable m
1010 else
1111 end
12- m . strip #$ Alert
12+ m . strip # $ Alert
1313 m2 # undefined local variable or method 'm2' for main (NameError)
1414end
1515
@@ -31,7 +31,7 @@ def test_guards
3131 b &.strip # OK - safe navigation
3232 b . strip if b # OK
3333 b . close if b && !b . closed # OK
34- b . blowup if b || !b . blownup #$ Alert
34+ b . blowup if b || !b . blownup # $ Alert
3535
3636 if false
3737 c = "0"
@@ -64,7 +64,7 @@ def test_loop
6464 a = 0
6565 else
6666 set_a
67- end
67+ end
6868 end until a # OK
6969 a . strip # OK - given previous until
7070end
@@ -73,5 +73,5 @@ def test_for
7373 for i in [ "foo" , "bar" ] # OK - since 0..10 cannot raise
7474 puts i . strip
7575 end
76- i . strip #$ SPURIOUS: Alert
77- end
76+ i . strip # $ SPURIOUS: Alert
77+ end
You can’t perform that action at this time.
0 commit comments