Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

29 lines (24 sloc) 0.799 kB
module WLang
describe Scope, '.chain' do
it 'returns Scope.null on empty chain' do
Scope.chain([]).should eq(Scope.null)
end
it 'returns a single scope on singleton' do
s = Scope.chain([{:who => "World"}])
s.should be_a(Scope::ObjectScope)
s.parent.should eq(Scope.null)
end
it 'uses the last scope as most specific' do
s = Scope.chain([{:who => "World"}, lambda{}])
s.should be_a(Scope::ProcScope)
s.parent.should be_a(Scope::ObjectScope)
s.parent.parent.should eq(Scope.null)
end
it 'strips nils' do
s = Scope.chain([nil, {:who => "World"}, nil, lambda{}, nil])
s.should be_a(Scope::ProcScope)
s.parent.should be_a(Scope::ObjectScope)
s.parent.parent.should eq(Scope.null)
end
end
end
Jump to Line
Something went wrong with that request. Please try again.