Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
32 lines (26 sloc) 663 Bytes
require "helper"
class LetNodeTest < Johnson::NodeTestCase
def test_let_to_sexp
assert_sexp(
[[:lexical_scope, [:name, "unnamed"], [[:let, [[:assign, [:name, "a"], [:lit, 1],
]]]]]],
@parser.parse('if(true) { let a = 1; }')
)
end
def test_let_to_ecma
assert_ecma(
"{\n let a = 1;\n};",
@parser.parse('if(true) { let a = 1; }')
)
end
def test_enumerating_visitor
count = 0
@parser.parse('if(true) { let a = 1; }').each do |node|
count += 1
end
assert_equal 7, count
end
def test_dot_visitor
@parser.parse('if(true) { let a = 1; }').to_dot
end
end
Something went wrong with that request. Please try again.