1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

Silence some warnings about unused vars

This commit is contained in:
Norman Clarke 2012-05-29 00:17:14 -03:00
parent 4f1b0b5bc8
commit 6e84a7abe8
2 changed files with 5 additions and 2 deletions

View file

@ -1264,6 +1264,9 @@ HAML
string.instance_variable_set("@var", "Instance variable")
b = string.instance_eval do
var = "Local variable"
# Silence unavoidable warning; Ruby doesn't know we're going to use this
# later.
nil if var
binding
end

View file

@ -84,14 +84,14 @@ class ErbFilterTest < MiniTest::Unit::TestCase
test "should evaluate in the same context as Haml" do
haml = ":erb\n <%= foo %>"
html = "bar\n"
scope = Object.new.instance_eval {foo = "bar"; binding}
scope = Object.new.instance_eval {foo = "bar"; nil if foo; binding}
assert_equal(html, render(haml, :scope => scope))
end
end
class JavascriptFilterTest < MiniTest::Unit::TestCase
test "should interpolate" do
scope = Object.new.instance_eval {foo = "bar"; binding}
scope = Object.new.instance_eval {foo = "bar"; nil if foo; binding}
haml = ":javascript\n \#{foo}"
html = render(haml, :scope => scope)
assert_match(/bar/, html)