Sha256: 62267c602140794c75da3c99d46dc9534dca5a9f7f16df97e5755afeffe71892

Contents?: true

Size: 983 Bytes

Versions: 1

Compression:

Stored size: 983 Bytes

Contents

require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'test_helper.rb'))

class FunctionDefinitionTest < Test::Unit::TestCase

  include KoiReferenceParser

  test "should parse function definition including it's statements" do
    tree = Parser.parse("test = function(args)\n  teest1 = 1\n  test2 = 2\nend")
    assert_kind_of Block, tree
    assert_kind_of Statement, tree.elements.first
    assert_kind_of Assignment, tree.elements.first.elements.first
    assert_kind_of FunctionDefinition, tree.elements.first.elements.first.elements.last
    assert_kind_of Identifier, tree.elements.first.elements.first.elements.last.elements.first
    assert_kind_of Block, tree.elements.first.elements.first.elements.last.elements.last
    assert_kind_of Statement, tree.elements.first.elements.first.elements.last.elements.last.elements[0]
    assert_kind_of Statement, tree.elements.first.elements.first.elements.last.elements.last.elements[1]
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
koi-reference-parser-0.0.1 test/parser/unit/function_definition_test.rb