Commit graph

20 commits

Author SHA1 Message Date
Stan Lo
f193f96d31 [ruby/irb] Page evaluation result's output
(https://github.com/ruby/irb/pull/784)

* Page evaluation result's output

This will make it easier to work with long output that exceeds the terminal's height.

* Use consistent TERM in rendering tests

This makes sure we get consistent result on all platforms.

4fedce93d3
2023-11-30 15:22:22 +00:00
Stan Lo
9cd086ba4b [ruby/irb] Support disabling pager
(https://github.com/ruby/irb/pull/783)

With either `IRB.conf[:USE_PAGER] = false` or `--no-pager` commnad line flag.

I decided use `--no-pager` instead of `--use-pager` because it matches with
Pry and git's command line flags.

df1c3b9042
2023-11-26 11:07:50 +00:00
Stan Lo
f37f357e80 [ruby/irb] Improve help/show_cmds message during debugger
integration
(https://github.com/ruby/irb/pull/693)

* `help` should display debugger's help during irb:rdbg session

* Update `show_cmds`'s output when in irb:rdbg session

4029c2e564
2023-08-29 18:36:16 +00:00
Stan Lo
ca6db02c2a [ruby/irb] Avoid overriding user's irb_name setting in debugger
integration
(https://github.com/ruby/irb/pull/688)

* Avoid overriding user's irb_name setting in debugger integration

Instead of always setting `irb_name` to `irb:rdbg`, it should respect
the user's setting and only append `:rdbg` to it.

* Introduce write_rc test helper

2ce7593351
2023-08-21 18:23:32 +00:00
Stan Lo
7f8f62c93b [ruby/irb] Support seamless integration with ruby/debug
(https://github.com/ruby/irb/pull/575)

* Support native integration with ruby/debug

* Prevent using multi-irb and activating debugger at the same time

Multi-irb makes a few assumptions:

- IRB will manage all threads that host sub-irb sessions
- All IRB sessions will be run on the threads created by IRB itself

However, when using the debugger these assumptions are broken:

- `debug` will freeze ALL threads when it suspends the session (e.g. when
  hitting a breakpoint, or performing step-debugging).
- Since the irb-debug integration runs IRB as the debugger's interface,
  it will be run on the debugger's thread, which is not managed by IRB.

So we should prevent the 2 features from being used at the same time.
To do that, we check if the other feature is already activated when
executing the commands that would activate the other feature.

d8fb3246be
2023-08-13 18:30:34 +00:00
Stan Lo
c173c637ab [ruby/irb] Skip integration tests in core CI
(https://github.com/ruby/irb/pull/677)

We already skipped history integration tests in core CI in #675 due to
suspicion on nested IRB sessions don't work on certain operating systems.

But after #669, the evaluation integration test also started to fail on
some Core CI suites. So, it looks like the integration test setup may not
work in Core CI, at least in some suites.

Consider `ruby/irb` already has rather sophisticated test suite, I think
it's better to skip the integration tests in core CI for now.

6f49b4c108
2023-08-11 18:27:17 +00:00
Stan Lo
c4066af35e [ruby/irb] Store integration tests' envs in an ivar
(https://github.com/ruby/irb/pull/668)

bbd20445ea
2023-08-04 17:13:55 +00:00
Stan Lo
8ecd300e1e [ruby/irb] Extract integration testing helpers out of debug command
tests
(https://github.com/ruby/irb/pull/660)

The ability to run a test case in a subprocess is useful for testing
many other features, like nested IRB sessions. So I think it's worth
extracting them into a new test case class.

73b7a895f8
2023-08-02 18:33:43 +00:00
Stan Lo
8305681729 [ruby/irb] Require test/lib helpers from main test helper
(https://github.com/ruby/irb/pull/595)

Because they are handled differently in `ruby/irb` and `ruby/ruby`.
2023-06-02 13:54:07 +00:00
Stan Lo
2d2893f206 [ruby/irb] Improve debug command tests
(https://github.com/ruby/irb/pull/594)

* Use require_relative for envutil.rb

Requiring test helper files with `require_relative` allows running the tests
with `ruby -Itest test/irb/test_debug_cmd.rb` without having to set up
the load path.

* Replace reline hack with TERM=dumb
2023-06-01 20:10:13 +00:00
tomoya ishida
264ba0f89a [ruby/irb] Fix Test timedout in test_debug_cmd
(https://github.com/ruby/irb/pull/582)

* Suppress Reline::IOGate.cursor_pos writing escape sequence in test_debug_cmd

* Force use Reline::GeneralIO as Reline::IOGate and remove RUBY_DEBUG_NO_RELINE option for debug test
2023-05-17 04:42:32 +00:00
Nobuyoshi Nakada
1148636e3d [ruby/irb] PTY module is platform dependent
dbb3dc72ff
2022-12-19 17:49:59 +09:00
Stan Lo
381e128c13 [ruby/irb] Fix step command (https://github.com/ruby/irb/pull/477)
The current `next` pre-command workaround on IRB source stepping
moves the location by 1 extra line. A better way is to make `debug`
skip IRB frames completely, which is what this commit does.

It also fixes the step command's test. The `|` in regexp was not escaped
so it was always incorrectly matched.
2022-12-09 23:39:17 +00:00
Stan Lo
a87f802f1e [ruby/irb] Kill PTY process after test is finished
(https://github.com/ruby/irb/pull/471)

The killing/waiting logic is borrowed from ruby/debug:

ec5ae5aebd/test/support/test_case.rb (L107-L136)
2022-12-08 19:11:51 +00:00
Nobuyoshi Nakada
74923aaf31 [ruby/irb] Close leaked pty IOs
cc9b1d7ba8
2022-12-05 12:03:57 +00:00
Stan Lo
69fd673b1a [ruby/irb] Disable debug cmd tests based on project structure
instead of env
(https://github.com/ruby/irb/pull/466)

It's hard to find an env var that's universally set in all Ruby CI
environments but not in local. Checking gemspec seems to be a better way
as `syntax_suggest` already uses it for a while.

d8f1bca297/spec/spec_helper.rb (L47)
2022-12-02 20:43:59 +00:00
Takashi Kokubun
f01bfa8af7 [ruby/irb] This doesn't work on RubyCI either
20221202T063302Z.fail.html.gz
20221202T053006Z.fail.html.gz
20221202T063002Z.fail.html.gz
20221202T054503Z.fail.html.gz

13c2484d59
2022-12-02 07:41:18 +00:00
Takashi Kokubun
7e3b42d008 [ruby/irb] Skip debug command tests on ruby/ruby
Stan has said these tests could be excluded if they don't work on
ruby/ruby CI.

11e779ecb7
2022-12-02 04:43:36 +00:00
Nobuyoshi Nakada
b6c66ead9d [ruby/irb] Use the proper ruby command and library path
1416cc1871
2022-12-02 03:14:51 +00:00
Stan Lo
8abf9e6ad0 [ruby/irb] Test debug commands without yamatanooroti
(https://github.com/ruby/irb/pull/464)

* Add debug command tests that don't require yamatanooroti

* Remove debug command related yamatanooroti tests

As discussed in https://github.com/ruby/irb/pull/449#pullrequestreview-1187255149,
we should avoid adding new tests that need yamatanooroti because it's
not maintained by the Ruby org. And since debug commands are now tested
in `test/irb/test_debug_cmd.rb`, we don't need these tests anymore.

* Test against latest debug gem

78a8aa8834
2022-12-02 01:05:22 +00:00