diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-03-03 11:34:01 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-03-03 02:44:35 +0000 |
commit | bd17bea6c5105133d8ba9c0e8ae6c89506a15823 (patch) | |
tree | 23a37c83eea6cbd62efe2807433d7e1165d6481a /test | |
parent | 941d36d195691949afe2ce464b0d0aa20208e637 (diff) |
[ruby/irb] Fix warnings because of `@context.main.delete`
If the main object of the context has `#delete` method, the following
warning is printed.
```
irb: warn: can't alias delete from irb_delete.
```
https://github.com/ruby/irb/commit/00b39be61f
Diffstat (limited to 'test')
-rw-r--r-- | test/irb/test_context.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/test/irb/test_context.rb b/test/irb/test_context.rb index 9b471202bc..fd345f826a 100644 --- a/test/irb/test_context.rb +++ b/test/irb/test_context.rb @@ -657,7 +657,8 @@ module TestIRB end def test_prompt_main_escape - irb = IRB::Irb.new(IRB::WorkSpace.new("main\a\t\r\n")) + main = Struct.new(:to_s).new("main\a\t\r\n") + irb = IRB::Irb.new(IRB::WorkSpace.new(main)) assert_equal("irb(main )>", irb.prompt('irb(%m)>', nil, 1, 1)) end @@ -668,7 +669,9 @@ module TestIRB end def test_prompt_main_truncate - irb = IRB::Irb.new(IRB::WorkSpace.new("a" * 100)) + main = Struct.new(:to_s).new("a" * 100) + def main.inspect; to_s.inspect; end + irb = IRB::Irb.new(IRB::WorkSpace.new(main)) assert_equal('irb(aaaaaaaaaaaaaaaaaaaaaaaaaaaaa...)>', irb.prompt('irb(%m)>', nil, 1, 1)) assert_equal('irb("aaaaaaaaaaaaaaaaaaaaaaaaaaaa...)>', irb.prompt('irb(%M)>', nil, 1, 1)) end |