Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove and Restore irb configuration like irbrc while irb console tests #1067

Merged
merged 1 commit into from
Feb 20, 2024

Conversation

hsbt
Copy link
Member

@hsbt hsbt commented Jan 22, 2024

Description

irb_test.rb will refer IRB configuration like .irbrc or something from User's environment. I always got test failure about them. This is my .irbrc.

IRB.conf.update(
  :SAVE_HISTORY => 10000,
  :HISTORY_FILE => File.join(ENV["XDG_DATA_HOME"], "irb", "history"),
  :PROMPT_MODE => :SIMPLE,
  :LOAD_MODULES => ['irb/completion', 'active_support/all'],
  :USE_MULTILINE => true,
)

See the following result from make test-bundled-gems.

Failure: test_irb_command_switches_console_to_irb(DEBUGGER__::IrbTest):

  --------------------
  | Debugger Session |
  --------------------

  > [1, 2] in /var/folders/_z/1_hsk6zx07v57yg5wlsjxvc80000gn/T/debug-20240122-96632-yvf6i8.rb
  > =>   1| a = 1
  >      2| b = 2
  > =>#0        <main> at /var/folders/_z/1_hsk6zx07v57yg5wlsjxvc80000gn/T/debug-20240122-96632-yvf6i8.rb:1
  > (rdbg) irb
  > /Users/hsbt/Documents/github.com/ruby/ruby/lib/irb/init.rb:453: warning: LoadError: cannot load such file -- active_support/all
  > 123
  > >> >> 1>> 12>> 123123




  -------------------
  | Failure Message |
  -------------------

  Expected to include `"irb:rdbg\\(main\\):002>\\ 123"` in
  (
  >> >> 1>> 12>> 123123
  )
   on LOCAL mode
/Users/hsbt/Documents/github.com/ruby/ruby/gems/src/debug/test/support/assertions.rb:97:in `assert_block'
/Users/hsbt/Documents/github.com/ruby/ruby/gems/src/debug/test/support/assertions.rb:56:in `block in assert_line_text'
/Users/hsbt/Documents/github.com/ruby/ruby/gems/src/debug/test/support/console_test_case.rb:152:in `block (3 levels) in run_test_scenario'
<internal:kernel>:187:in `loop'
/Users/hsbt/Documents/github.com/ruby/ruby/gems/src/debug/test/support/console_test_case.rb:143:in `block (2 levels) in run_test_scenario'
/Users/hsbt/Documents/github.com/ruby/ruby/lib/timeout.rb:187:in `block in timeout'
/Users/hsbt/Documents/github.com/ruby/ruby/lib/timeout.rb:42:in `handle_timeout'
/Users/hsbt/Documents/github.com/ruby/ruby/lib/timeout.rb:196:in `timeout'
/Users/hsbt/Documents/github.com/ruby/ruby/gems/src/debug/test/support/console_test_case.rb:127:in `block in run_test_scenario'
/Users/hsbt/Documents/github.com/ruby/ruby/gems/src/debug/test/support/console_test_case.rb:123:in `spawn'
/Users/hsbt/Documents/github.com/ruby/ruby/gems/src/debug/test/support/console_test_case.rb:123:in `run_test_scenario'
/Users/hsbt/Documents/github.com/ruby/ruby/gems/src/debug/test/support/console_test_case.rb:257:in `debug_code_on_local'
/Users/hsbt/Documents/github.com/ruby/ruby/gems/src/debug/test/support/console_test_case.rb:116:in `block (2 levels) in debug_code'
/Users/hsbt/Documents/github.com/ruby/ruby/gems/src/debug/test/support/console_test_case.rb:230:in `prepare_test_environment'
/Users/hsbt/Documents/github.com/ruby/ruby/gems/src/debug/test/support/console_test_case.rb:90:in `block in debug_code'
/Users/hsbt/Documents/github.com/ruby/ruby/lib/timeout.rb:187:in `block in timeout'
/Users/hsbt/Documents/github.com/ruby/ruby/lib/timeout.rb:42:in `handle_timeout'
/Users/hsbt/Documents/github.com/ruby/ruby/lib/timeout.rb:196:in `timeout'
/Users/hsbt/Documents/github.com/ruby/ruby/gems/src/debug/test/support/console_test_case.rb:89:in `debug_code'
/Users/hsbt/Documents/github.com/ruby/ruby/gems/src/debug/test/console/irb_test.rb:32:in `test_irb_command_switches_console_to_irb'
     29:     end
     30:
     31:     def test_irb_command_switches_console_to_irb
  => 32:       debug_code(program, remote: false) do
     33:         type 'irb'
     34:         type '123'
     35:         assert_line_text 'irb:rdbg(main):002> 123'

I stub-out their configuration with setup block of test-unit. After that, these are resolved.

@hsbt
Copy link
Member Author

hsbt commented Jan 22, 2024

/cc @st0012

Copy link
Member

@st0012 st0012 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the hassle and thanks for the fix 👍

@st0012
Copy link
Member

st0012 commented Jan 22, 2024

BTW, unless you need to work with old IRB (before v1.2.1, which came with Ruby 2.7), I think USE_MULTILINE is not necessary as it's the default, as well as loading irb/completion.

@hsbt
Copy link
Member Author

hsbt commented Jan 24, 2024

I think USE_MULTILINE is not necessary as it's the default

I didn't know that. Thanks!

matzbot pushed a commit to ruby/ruby that referenced this pull request Jan 24, 2024
@ko1 ko1 merged commit 315ecaf into master Feb 20, 2024
24 checks passed
@ko1 ko1 deleted the stubout-irbrc branch February 20, 2024 09:50
@ko1
Copy link
Collaborator

ko1 commented Feb 20, 2024

thanks

@hsbt
Copy link
Member Author

hsbt commented Feb 20, 2024

Thank you 👍

xjunior referenced this pull request in powerhome/audiences Apr 8, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [debug](https://togithub.com/ruby/debug) | `1.9.1` -> `1.9.2` |
[![age](https://developer.mend.io/api/mc/badges/age/rubygems/debug/1.9.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/rubygems/debug/1.9.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/rubygems/debug/1.9.1/1.9.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/rubygems/debug/1.9.1/1.9.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>ruby/debug (debug)</summary>

### [`v1.9.2`](https://togithub.com/ruby/debug/releases/tag/v1.9.2)

[Compare
Source](https://togithub.com/ruby/debug/compare/v1.9.1...v1.9.2)

#### What's Changed

-   config
- Make irb_console toggleable with config update by
[@&#8203;st0012](https://togithub.com/st0012) in
[https://github.com/ruby/debug/pull/1057](https://togithub.com/ruby/debug/pull/1057)
-   internal
- Stop assuming Array#each is written in C by
[@&#8203;k0kubun](https://togithub.com/k0kubun) in
[https://github.com/ruby/debug/pull/1061](https://togithub.com/ruby/debug/pull/1061)
- Add `base64` gem to the dependencies by
[@&#8203;y-yagi](https://togithub.com/y-yagi) in
[https://github.com/ruby/debug/pull/1066](https://togithub.com/ruby/debug/pull/1066)
- Support Ruby 3.4's new error message format by
[@&#8203;hsbt](https://togithub.com/hsbt) in
[https://github.com/ruby/debug/pull/1080](https://togithub.com/ruby/debug/pull/1080)
- catch up ruby 3.4.0 error related changes by
[@&#8203;ko1](https://togithub.com/ko1) in
[https://github.com/ruby/debug/pull/1083](https://togithub.com/ruby/debug/pull/1083)
- Fix syntax warnings by
[@&#8203;casperisfine](https://togithub.com/casperisfine) in
[https://github.com/ruby/debug/pull/1072](https://togithub.com/ruby/debug/pull/1072)
- Drop base64 dependency by
[@&#8203;Earlopain](https://togithub.com/Earlopain) in
[https://github.com/ruby/debug/pull/1071](https://togithub.com/ruby/debug/pull/1071)
- Fix ENOENT error when readline is not loaded by
[@&#8203;lazyatom](https://togithub.com/lazyatom) in
[https://github.com/ruby/debug/pull/1073](https://togithub.com/ruby/debug/pull/1073)
- Remove and Restore irb configuration like irbrc while irb console
tests by [@&#8203;hsbt](https://togithub.com/hsbt) in
[https://github.com/ruby/debug/pull/1067](https://togithub.com/ruby/debug/pull/1067)
- Use rb_iseqw_to_iseq to get iseq pointer by
[@&#8203;peterzhu2118](https://togithub.com/peterzhu2118) in
[https://github.com/ruby/debug/pull/1093](https://togithub.com/ruby/debug/pull/1093)
-   tests
- Add Ruby 3.3 to CI matrix by
[@&#8203;st0012](https://togithub.com/st0012) in
[https://github.com/ruby/debug/pull/1058](https://togithub.com/ruby/debug/pull/1058)
- Use ruby/actions workflow for ruby versions by
[@&#8203;m-nakamura145](https://togithub.com/m-nakamura145) in
[https://github.com/ruby/debug/pull/1065](https://togithub.com/ruby/debug/pull/1065)
- Separate setup and execution steps in CI by
[@&#8203;ono-max](https://togithub.com/ono-max) in
[https://github.com/ruby/debug/pull/1088](https://togithub.com/ruby/debug/pull/1088)
- Fix flakey test "test_reponse_returns_correct_threads_info" by
[@&#8203;ono-max](https://togithub.com/ono-max) in
[https://github.com/ruby/debug/pull/1089](https://togithub.com/ruby/debug/pull/1089)
- Add Launchable in CI by
[@&#8203;ono-max](https://togithub.com/ono-max) in
[https://github.com/ruby/debug/pull/1090](https://togithub.com/ruby/debug/pull/1090)
-   doc
- Correct the irb command's description by
[@&#8203;st0012](https://togithub.com/st0012) in
[https://github.com/ruby/debug/pull/1056](https://togithub.com/ruby/debug/pull/1056)
- Fix prelude doc example to use curly braces by
[@&#8203;adam12](https://togithub.com/adam12) in
[https://github.com/ruby/debug/pull/1052](https://togithub.com/ruby/debug/pull/1052)
- Mention IRB console in readme by
[@&#8203;st0012](https://togithub.com/st0012) in
[https://github.com/ruby/debug/pull/1092](https://togithub.com/ruby/debug/pull/1092)

#### New Contributors

- [@&#8203;Earlopain](https://togithub.com/Earlopain) made their first
contribution in
[https://github.com/ruby/debug/pull/1071](https://togithub.com/ruby/debug/pull/1071)
- [@&#8203;lazyatom](https://togithub.com/lazyatom) made their first
contribution in
[https://github.com/ruby/debug/pull/1073](https://togithub.com/ruby/debug/pull/1073)
- [@&#8203;m-nakamura145](https://togithub.com/m-nakamura145) made their
first contribution in
[https://github.com/ruby/debug/pull/1065](https://togithub.com/ruby/debug/pull/1065)

**Full Changelog**:
ruby/debug@v1.9.1...v1.9.2

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/powerhome/audiences).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yNjkuMiIsInVwZGF0ZWRJblZlciI6IjM3LjI2OS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants