Skip to content

Commit

Permalink
Fix warnings because of @context.main.delete
Browse files Browse the repository at this point in the history
If the main object of the context has `#delete` method, the following
warning is printed.

```
irb: warn: can't alias delete from irb_delete.
```
  • Loading branch information
nobu committed Mar 3, 2023
1 parent ef90285 commit 00b39be
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/irb/test_context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,8 @@ def test_eval_input_with_long_exception
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

Expand All @@ -668,7 +669,9 @@ def test_prompt_main_inspect_escape
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
Expand Down

0 comments on commit 00b39be

Please sign in to comment.