1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

clean up a couple of test errors for whitespace

This commit is contained in:
Jeremy Ashkenas 2009-12-30 00:08:49 -05:00
parent dd3c9abe15
commit 90051e9096

View file

@ -21,7 +21,7 @@ class ParserTest < Test::Unit::TestCase
end end
def test_parsing_an_object_literal def test_parsing_an_object_literal
nodes = @par.parse("{one : 1 \n two : 2}").expressions nodes = @par.parse("{one : 1\ntwo : 2}").expressions
obj = nodes.first.literal obj = nodes.first.literal
assert obj.is_a? ObjectNode assert obj.is_a? ObjectNode
assert obj.properties.first.variable.literal.value == "one" assert obj.properties.first.variable.literal.value == "one"
@ -29,7 +29,7 @@ class ParserTest < Test::Unit::TestCase
end end
def test_parsing_an_function_definition def test_parsing_an_function_definition
code = @par.parse("x, y => x * y.").expressions.first code = @par.parse("x, y => x * y").expressions.first
assert code.params == ['x', 'y'] assert code.params == ['x', 'y']
body = code.body.expressions.first body = code.body.expressions.first
assert body.is_a? OpNode assert body.is_a? OpNode
@ -45,7 +45,7 @@ class ParserTest < Test::Unit::TestCase
end end
def test_parsing_array_comprehension def test_parsing_array_comprehension
nodes = @par.parse("i for x, i in [10, 9, 8, 7, 6, 5] if i % 2 is 0.").expressions nodes = @par.parse("i for x, i in [10, 9, 8, 7, 6, 5] if i % 2 is 0").expressions
assert nodes.first.is_a? ForNode assert nodes.first.is_a? ForNode
assert nodes.first.body.literal == 'i' assert nodes.first.body.literal == 'i'
assert nodes.first.filter.operator == '===' assert nodes.first.filter.operator == '==='
@ -53,7 +53,7 @@ class ParserTest < Test::Unit::TestCase
end end
def test_parsing_comment def test_parsing_comment
nodes = @par.parse("a: 1\n # comment\nb: 2").expressions nodes = @par.parse("a: 1\n# comment\nb: 2").expressions
assert nodes[1].is_a? CommentNode assert nodes[1].is_a? CommentNode
end end
@ -79,7 +79,7 @@ class ParserTest < Test::Unit::TestCase
def test_no_wrapping_parens_around_statements def test_no_wrapping_parens_around_statements
assert_raises(SyntaxError) do assert_raises(SyntaxError) do
@par.parse("(try thing() catch error fail().)").compile @par.parse("(try thing() catch error fail())").compile
end end
end end