summaryrefslogtreecommitdiff
path: root/spec/ruby/core/binding
diff options
context:
space:
mode:
authoreregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-03-28 14:22:29 +0000
committereregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-03-28 14:22:29 +0000
commita28aa80c739a1d169649a4da833ef48cfb3465b3 (patch)
treec2f6bb79c268bd60116b54319ea96f01bb7dda79 /spec/ruby/core/binding
parent0f64776745ef31e626dec0d42b7fb2a5988397ec (diff)
Update to ruby/spec@e81b3cd
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67361 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/core/binding')
-rw-r--r--spec/ruby/core/binding/fixtures/irb.rb3
-rw-r--r--spec/ruby/core/binding/irb_spec.rb17
2 files changed, 20 insertions, 0 deletions
diff --git a/spec/ruby/core/binding/fixtures/irb.rb b/spec/ruby/core/binding/fixtures/irb.rb
new file mode 100644
index 0000000000..5f305f2d5d
--- /dev/null
+++ b/spec/ruby/core/binding/fixtures/irb.rb
@@ -0,0 +1,3 @@
+a = 10
+
+binding.irb
diff --git a/spec/ruby/core/binding/irb_spec.rb b/spec/ruby/core/binding/irb_spec.rb
new file mode 100644
index 0000000000..dd3df0b28a
--- /dev/null
+++ b/spec/ruby/core/binding/irb_spec.rb
@@ -0,0 +1,17 @@
+require_relative '../../spec_helper'
+
+ruby_version_is "2.5" do
+ describe "Binding#irb" do
+ it "creates an IRB session with the binding in scope" do
+ irb_fixture = fixture __FILE__, "irb.rb"
+
+ out = IO.popen([*ruby_exe, irb_fixture], "r+") do |pipe|
+ pipe.puts "a ** 2"
+ pipe.puts "exit"
+ pipe.readlines.map(&:chomp)
+ end
+
+ out[-3..-1].should == ["a ** 2", "100", "exit"]
+ end
+ end
+end