Sha256: 102cc048c248b8ee1bcdf95845bf6f56f7753685cb1319dd495a586a77bdb997
Contents?: true
Size: 978 Bytes
Versions: 1
Compression:
Stored size: 978 Bytes
Contents
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'test_helper.rb')) class SyntaxNodeToHashTest < Test::Unit::TestCase include KoiReferenceParser test "should convert SyntaxNode to hash" do input = "test = 1" tree = Identifier.new(input, 0...4) hash = tree.to_hash assert_equal( { :elements => nil, :offset => 0, :name => "Identifier", :text_value => "test" }, hash ) end test "should convert SyntaxNode to hash including elements" do input = "test = 1" tree = Assignment.new(input, 0...8, [ Identifier.new(input, 0...4) ]) hash = tree.to_hash built_hash = { :elements => nil, :offset => 0, :name => "Assignment", :text_value => "test = 1" } built_hash[:elements] = [ { :elements => nil, :offset => 0, :name => "Identifier", :text_value => "test" } ] assert_equal( built_hash, hash ) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
koi-reference-parser-0.0.2 | test/parser/unit/syntax_node_to_hash_test.rb |