mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Update to ruby/spec@875a09e
This commit is contained in:
parent
a06301b103
commit
5c276e1cc9
1247 changed files with 5316 additions and 5028 deletions
|
@ -26,7 +26,7 @@ describe 'Binding#local_variable_defined?' do
|
|||
|
||||
it 'returns true when a local variable is defined in a parent scope' do
|
||||
foo = 10
|
||||
lambda {
|
||||
-> {
|
||||
binding.local_variable_defined?(:foo)
|
||||
}.call.should == true
|
||||
end
|
||||
|
|
|
@ -11,7 +11,7 @@ describe "Binding#local_variable_get" do
|
|||
it "raises a NameError for missing variables" do
|
||||
bind = BindingSpecs::Demo.new(1).get_empty_binding
|
||||
|
||||
lambda {
|
||||
-> {
|
||||
bind.local_variable_get(:no_such_variable)
|
||||
}.should raise_error(NameError)
|
||||
end
|
||||
|
@ -19,7 +19,7 @@ describe "Binding#local_variable_get" do
|
|||
it "reads variables added later to the binding" do
|
||||
bind = BindingSpecs::Demo.new(1).get_empty_binding
|
||||
|
||||
lambda {
|
||||
-> {
|
||||
bind.local_variable_get(:a)
|
||||
}.should raise_error(NameError)
|
||||
|
||||
|
@ -31,7 +31,7 @@ describe "Binding#local_variable_get" do
|
|||
it 'gets a local variable defined in a parent scope' do
|
||||
number = 10
|
||||
|
||||
lambda {
|
||||
-> {
|
||||
binding.local_variable_get(:number)
|
||||
}.call.should == 10
|
||||
end
|
||||
|
@ -45,12 +45,12 @@ describe "Binding#local_variable_get" do
|
|||
|
||||
it "raises a NameError on global access" do
|
||||
bind = binding
|
||||
lambda { bind.local_variable_get(:$0) }.should raise_error(NameError)
|
||||
-> { bind.local_variable_get(:$0) }.should raise_error(NameError)
|
||||
end
|
||||
|
||||
it "raises a NameError on special variable access" do
|
||||
bind = binding
|
||||
lambda { bind.local_variable_get(:$~) }.should raise_error(NameError)
|
||||
lambda { bind.local_variable_get(:$_) }.should raise_error(NameError)
|
||||
-> { bind.local_variable_get(:$~) }.should raise_error(NameError)
|
||||
-> { bind.local_variable_get(:$_) }.should raise_error(NameError)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -38,7 +38,7 @@ describe "Binding#local_variable_set" do
|
|||
bind = binding
|
||||
bind.local_variable_set(:number, 10)
|
||||
|
||||
lambda { number }.should raise_error(NameError)
|
||||
-> { number }.should raise_error(NameError)
|
||||
end
|
||||
|
||||
it 'overwrites an existing local variable defined before a Binding' do
|
||||
|
@ -59,13 +59,13 @@ describe "Binding#local_variable_set" do
|
|||
|
||||
it "raises a NameError on global access" do
|
||||
bind = binding
|
||||
lambda { bind.local_variable_set(:$0, "") }.should raise_error(NameError)
|
||||
-> { bind.local_variable_set(:$0, "") }.should raise_error(NameError)
|
||||
end
|
||||
|
||||
it "raises a NameError on special variable access" do
|
||||
bind = binding
|
||||
lambda { bind.local_variable_set(:$~, "") }.should raise_error(NameError)
|
||||
lambda { bind.local_variable_set(:$_, "") }.should raise_error(NameError)
|
||||
-> { bind.local_variable_set(:$~, "") }.should raise_error(NameError)
|
||||
-> { bind.local_variable_set(:$_, "") }.should raise_error(NameError)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue