summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorStan Lo <stan001212@gmail.com>2023-08-23 16:37:16 +0100
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2023-08-29 18:15:05 +0900
commit221c2d0e19171f059461f8a8c3489cd9578ed43e (patch)
treee102feefd56c789c5e1b1505181db30d106fd2d9 /test
parent0cd92819c933ac3aea8eb173986b6478fcd1fbfe (diff)
[ruby/irb] Print deprecation message for prompt_n methods
(https://github.com/ruby/irb/pull/691) They were removed in #685, but we should still keep them to avoid breaking changes to tools like Chef. https://github.com/chef/chef/blob/533ff089479763f29045e4e6ddf388b73fc99338/lib/chef/shell.rb#L138 https://github.com/ruby/irb/commit/b585e0c835
Diffstat (limited to 'test')
-rw-r--r--test/irb/test_context.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/irb/test_context.rb b/test/irb/test_context.rb
index 29c67392f3..dae0f8f6e4 100644
--- a/test/irb/test_context.rb
+++ b/test/irb/test_context.rb
@@ -90,6 +90,18 @@ module TestIRB
], out)
end
+ def test_prompt_n_deprecation
+ irb = IRB::Irb.new(IRB::WorkSpace.new(Object.new))
+
+ out, err = capture_output do
+ irb.context.prompt_n = "foo"
+ irb.context.prompt_n
+ end
+
+ assert_include err, "IRB::Context#prompt_n is deprecated"
+ assert_include err, "IRB::Context#prompt_n= is deprecated"
+ end
+
def test_output_to_pipe
require 'stringio'
input = TestInputMethod.new(["n=1"])