Skip to content
This repository has been archived by the owner on Mar 16, 2023. It is now read-only.

Commit

Permalink
Test ::Foo lookup.
Browse files Browse the repository at this point in the history
  • Loading branch information
mvidner committed Jun 28, 2016
1 parent 8e6666e commit 2c711ac
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion spec/ruby-lint/constant_path_spec.rb
Expand Up @@ -24,7 +24,7 @@

context 'resolving definitions' do
before :all do
@scope = ruby_object.new(:type => :const, :name => 'Example')
@scope = ruby_object.new(:type => :root, :name => 'root')
@foo = @scope.define_constant('Foo')
@bar = @foo.define_constant('Bar')

Expand All @@ -50,6 +50,16 @@
defs.type.should == :const
end

example 'resolve a path of an absolute constant' do
node = s(:const, s(:const, s(:cbase), :Foo), :Bar)
defs = RubyLint::ConstantPath.new(node).resolve(@scope)

defs.is_a?(ruby_object).should == true

defs.name.should == 'Bar'
defs.type.should == :const
end

example 'resolve a path containing a variable' do
node = s(:const, s(:lvar, :example), :Bar)
defs = RubyLint::ConstantPath.new(node).resolve(@scope)
Expand Down

0 comments on commit 2c711ac

Please sign in to comment.