Sha256: 8ae1bebe2b025c21d837377c23bb5b7da8f8319576071de379037085d34ffc22
Contents?: true
Size: 1.2 KB
Versions: 1
Compression:
Stored size: 1.2 KB
Contents
require 'test/unit' require_relative '../generated/Tokens' require_relative '../generated/AbstractSyntaxTree' require_relative 'test_helper' class AbstractSyntaxTreeTest < Test::Unit::TestCase def get_method_call &b exp = get_sexp &b exp[3] end def get_context(roles={},contracts={},role_aliases={},defining=nil,private_interactions= {}) InterpretationContext.new(roles, contracts, role_aliases,defining,private_interactions) end def test_rolemethod method_call = get_method_call { foo.bar } production = get_production(method_call) type = production.type assert_equal(Tokens::rolemethod_call, type) end def get_production(method_call) contracts ={} roles = {:foo => {:bar => []}} AbstractSyntaxTree.new(method_call, get_context(roles, contracts)) end def test_call method_call = get_method_call { foo.baz } production = get_production(method_call) type = production.type assert_equal(Tokens::call, type) end def test_indexer method_call = get_method_call { foo[0] } production = get_production(method_call) type = production.type assert_equal(Tokens::indexer, type) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
maroon-0.7.1 | Test/abstract_syntax_tree_test.rb |