Sha256: 86a802d94c2da44d9fd9b3757f93a5f431bb258dd7fc09b25afce5f42146e9bb
Contents?: true
Size: 1.31 KB
Versions: 1
Compression:
Stored size: 1.31 KB
Contents
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'test_helper.rb')) class AssignmentToHashTest < Test::Unit::TestCase include KoiReferenceParser test "assignment to hash key" do tree = Parser.parse('test[1] = 1') assert_kind_of Block, tree assert_kind_of Statement, tree.elements.first assert_kind_of HashAssignment, tree.elements.first.elements.first assert_kind_of Identifier, tree.elements.first.elements.first.elements.first assert_kind_of HashAccessorList, tree.elements.first.elements.first.elements[1] assert_kind_of HashAccessor, tree.elements.first.elements.first.elements[1].elements.first assert_equal 1, tree.elements.first.elements.first.elements[1].elements.length end test "assignment to a chain of hash key" do tree = Parser.parse('test[1][2][3] = 1') assert_kind_of Block, tree assert_kind_of Statement, tree.elements.first assert_kind_of HashAssignment, tree.elements.first.elements.first assert_kind_of Identifier, tree.elements.first.elements.first.elements.first assert_kind_of HashAccessorList, tree.elements.first.elements.first.elements[1] assert_kind_of HashAccessor, tree.elements.first.elements.first.elements[1].elements.first assert_equal 3, tree.elements.first.elements.first.elements[1].elements.length end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
koi-reference-parser-0.0.3 | test/unit/assignment/assignment_to_hash_test.rb |