summaryrefslogtreecommitdiff
path: root/test/irb
AgeCommit message (Collapse)Author
2022-12-26[ruby/irb] Add test for the help commandst0012
https://github.com/ruby/irb/commit/9cacb5f352
2022-12-26[ruby/irb] Test colors with enabling colorsNobuyoshi Nakada
https://github.com/ruby/irb/commit/998b7a74fa
2022-12-19[ruby/irb] PTY module is platform dependentNobuyoshi Nakada
https://github.com/ruby/irb/commit/dbb3dc72ff
2022-12-16[ruby/irb] Prefer to use File.open instead of Kernel.openHiroshi SHIBATA
https://github.com/ruby/irb/commit/ed9e435a6b
2022-12-12[ruby/irb] Group show_doc tests and update the expectationStan Lo
(https://github.com/ruby/irb/pull/479) https://github.com/ruby/irb/commit/bede04c14a
2022-12-12[ruby/irb] `show_doc` command should take non-string argument tooStan Lo
(https://github.com/ruby/irb/pull/478) Given that `show_doc` already supports syntax like `String#gsub`, it should be able to take it in non-string form too, like `edit` and `show_source` do. This ensures users can have a consistent syntax on argument between different commands.
2022-12-09[ruby/irb] Fix step command (https://github.com/ruby/irb/pull/477)Stan Lo
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-08[ruby/irb] Add show_doc as an alias to the help commandStan Lo
(https://github.com/ruby/irb/pull/475) In the long-term, we want to align with `Pry`, `byebug` and `debug` to use the `help` command to list all commands, which is what `show_cmds` currently does. And `show_doc` will be the command to look up Ruby APIs. By aliasing `show_doc` to the current `help` now, users will have time to get use to it.
2022-12-08[ruby/irb] Gracefully handle missing command argumentStan Lo
(https://github.com/ruby/irb/pull/473) * Handle file loading commands' argument error gracefully Currently, if users don't provide an argument to `source`, `irb_load`, and `irb_require`, IRB raises `ArgumentError` with full stacktrace. This is confusing because it looks similar to when IRB has internal issues. The message also isn't helpful on helping users avoid the error. So in this commit, I add a new `CommandArgumentError` for commands to raise explicitly when users' input doesn't satisfy a command's argument requirement. * Gracefully handle `fg` command's argument requirement
2022-12-08[ruby/irb] Kill PTY process after test is finishedStan Lo
(https://github.com/ruby/irb/pull/471) The killing/waiting logic is borrowed from ruby/debug: https://github.com/ruby/debug/blob/ec5ae5aebd61a99dc84028d8dffa8e7e165c1ec6/test/support/test_case.rb#L107-L136
2022-12-08[ruby/irb] Add "show_cmds" command to list all commands'Stan Lo
descriptions (https://github.com/ruby/irb/pull/463) https://github.com/ruby/irb/commit/7e857655ac
2022-12-06[ruby/irb] Allow disabling autocompletion withStan Lo
`IRB_USE_AUTOCOMPLETE=false` (https://github.com/ruby/irb/pull/469) * Allow using IRB_USE_AUTOCOMPLETE=false to disable autocompletion Currently, the only 2 ways to disable autocompletion are: 1. Create `.irbrc` and set `IRB.conf[:USE_AUTOCOMPLETE] = false` 2. Add the `--noautocomplete` flag when using the `irb` executable Both of them are less convenient than setting a env var and are lesser known to devs. And given the number of problems the autocompletion has (see #445), I think we should allow disabling it with a simple `IRB_USE_AUTOCOMPLETE=false`. * Mention some env var configs in the README
2022-12-05[ruby/irb] Close leaked pty IOsNobuyoshi Nakada
https://github.com/ruby/irb/commit/cc9b1d7ba8
2022-12-02[ruby/irb] Require pathname in test helperStan Lo
(https://github.com/ruby/irb/pull/467) https://github.com/ruby/irb/commit/39c6924c12
2022-12-02[ruby/irb] Disable debug cmd tests based on project structureStan Lo
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. https://github.com/ruby/syntax_suggest/blob/d8f1bca297a392b80b5d167e2be07cf6ac4feae3/spec/spec_helper.rb#L47
2022-12-02[ruby/irb] This doesn't work on RubyCI eitherTakashi Kokubun
http://rubyci.s3.amazonaws.com/rhel_zlinux/ruby-master/log/20221202T063302Z.fail.html.gz http://rubyci.s3.amazonaws.com/openbsd-current/ruby-master/log/20221202T053006Z.fail.html.gz http://rubyci.s3.amazonaws.com/freebsd12/ruby-master/log/20221202T063002Z.fail.html.gz http://rubyci.s3.amazonaws.com/osx1013/ruby-master/log/20221202T054503Z.fail.html.gz https://github.com/ruby/irb/commit/13c2484d59
2022-12-02[ruby/irb] Skip debug command tests on ruby/rubyTakashi Kokubun
Stan has said these tests could be excluded if they don't work on ruby/ruby CI. https://github.com/ruby/irb/commit/11e779ecb7
2022-12-02[ruby/irb] Use the proper ruby command and library pathNobuyoshi Nakada
https://github.com/ruby/irb/commit/1416cc1871
2022-12-02[ruby/irb] Test debug commands without yamatanoorotiStan Lo
(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 https://github.com/ruby/irb/commit/78a8aa8834
2022-11-27[ruby/irb] Activate yamatanooroti tests on CIStan Lo
(https://github.com/ruby/irb/pull/459) * Activate yamatanooroti tests on CI * Fix delete test https://github.com/ruby/irb/commit/750cf4c480
2022-11-21[ruby/irb] Add commands to start and use the debuggerTakashi Kokubun
(https://github.com/ruby/irb/pull/449) * Seamlessly integrate a few debug commands * Improve the break command support * Utilize skip_src option if available * Add step and delete commands * Write end-to-end tests for each debugger command * Add documentation * Add backtrace, info, catch commands https://github.com/ruby/irb/commit/976100c1c2
2022-11-21Prevent a "warning: ambiguity between regexp and two divisions"Yusuke Endoh
2022-11-20[ruby/irb] Push an accidentally uncommitted diffTakashi Kokubun
https://github.com/ruby/irb/commit/7e9f27afd7
2022-11-20[ruby/irb] Deal with inconsistency with ruby/rubyTakashi Kokubun
https://github.com/ruby/irb/commit/41d5012849
2022-11-20[ruby/irb] Require missing EnvUtilTakashi Kokubun
https://github.com/ruby/irb/commit/9bb1757b02
2022-11-20[ruby/irb] Try using a different file nameTakashi Kokubun
hoping to address: https://github.com/ruby/ruby/actions/runs/3506561941/jobs/5873689640 https://github.com/ruby/irb/commit/de9a6b9d00
2022-11-20[ruby/irb] Require rubygems for ruby/rubyTakashi Kokubun
You can't take rubygems for granted in a default gem. https://github.com/ruby/ruby/actions/runs/3506561943/jobs/5873689466 https://github.com/ruby/irb/commit/58bb3954d0
2022-11-20[ruby/irb] Fix CI failure on ruby/rubyTakashi Kokubun
https://github.com/ruby/irb/commit/ea8c716922
2022-11-20[ruby/irb] Add edit command (https://github.com/ruby/irb/pull/453)Stan Lo
* Add edit command * Make find_source a public singleton method * Add document for the edit command * Make find_end private * Remove duplicated private https://github.com/ruby/irb/commit/4321674aa7 Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
2022-11-18Prevent a "method redefined" warningYusuke Endoh
http://rubyci.s3.amazonaws.com/ubuntu2004-arm/ruby-master/log/20221118T033003Z.log.html.gz ``` [21350/22024] TestIRB::ExtendCommandTest#test_show_source_end_finder/home/chkbuild/chkbuild/tmp/build/20221118T033003Z/ruby/test/irb/test_cmd.rb:523: warning: method redefined; discarding old show_source_test_method /home/chkbuild/chkbuild/tmp/build/20221118T033003Z/ruby/test/irb/test_cmd.rb:523: warning: previous definition of show_source_test_method was here ```
2022-11-17Drop Ruby 2.5 supportst0012
Because it has reached EOL for more than 1.5 years and it won't be supported by the next reline version either.
2022-11-15[ruby/irb] Improve testing infraStan Lo
(https://github.com/ruby/irb/pull/442) * Add test_in_isolation task to run tests in isolation This simulates how tests are run in Ruby CI and can detect some issues before they're merged and break Ruby CI later. * Run test_in_isolation task on CI * Fix TestRaiseNoBacktraceException's setup https://github.com/ruby/irb/commit/51f23c58b0
2022-11-15Added empty class for test methods in TestIRB casesHiroshi SHIBATA
2022-11-15[ruby/irb] Remove duplicated TestInputMethod definitionsst0012
https://github.com/ruby/irb/commit/4b831d02e1
2022-11-11[ruby/irb] Simplify info command's testsStan Lo
(https://github.com/ruby/irb/pull/440) https://github.com/ruby/irb/commit/5942949226
2022-11-10[ruby/irb] Transform ls's --grep/-G option to keyword argsTakashi Kokubun
(https://github.com/ruby/irb/pull/437) * Transform ls's --grep/-G option to keyword args * Make --grep less flexible * Support -g instead of --grep * Suppress warnings from symbol aliases
2022-11-10[ruby/irb] Make $ and @ default aliasesTakashi Kokubun
(https://github.com/ruby/irb/pull/438) https://github.com/ruby/irb/commit/0613589476
2022-11-08[ruby/irb] Add execute_lines to reduce command tests' boilerplateStan Lo
code (https://github.com/ruby/irb/pull/436) https://github.com/ruby/irb/commit/1595337149
2022-11-07[ruby/irb] Support non-string input in show_sourceTakashi Kokubun
(https://github.com/ruby/irb/pull/430) * Support non-string input in show_source * Test show_source as a method
2022-11-04[ruby/irb] Silent the noise created when building Context in testsStan Lo
https://github.com/ruby/irb/commit/27e4274b3c
2022-11-04[ruby/irb] Suppress "switching inspect mode" messagesNobuyoshi Nakada
https://github.com/ruby/irb/commit/ee068d039b
2022-11-03[ruby/irb] Provide a base test class and let tests restore encodingsStan Lo
conveniently (https://github.com/ruby/irb/pull/429) * Create a base TestIRB::TestCase class * Save/restore encodings for tests that initializes InputMethod classes Because `RelineInputMethod#initializes` calls `set_encoding`, which changes stdio/out/err and Encoding's default encoding values, we need to make sure any test that directly or indirectly (e.g. through Context) initializes `RelineInputMethod` restores encodings. `ReadlineInputMethod` also changes encodings but currently no tests cover it. * Remove unnecessary TestHelper module Since we now have a base TestCase, without_rdoc can just live there. https://github.com/ruby/irb/commit/c2874ec121
2022-11-03[ruby/irb] Allow non-identifier aliases like Pry's @ and $Takashi Kokubun
(https://github.com/ruby/irb/pull/426) * Allow non-identifier aliases * Move the configuration to IRB.conf * Avoid abusing method lookup for symbol aliases * Add more alias tests * A small optimization * Assume non-nil Context * Load IRB.conf earlier https://github.com/ruby/irb/commit/e23db5132e
2022-11-03[ruby/irb] Require rubygems to run the test alone on ruby/rubyTakashi Kokubun
`Gem` is not undefined on test-all https://github.com/ruby/irb/commit/08ac803d61
2022-11-03[ruby/irb] Fix build_context for ruby/ruby CITakashi Kokubun
Co-Authored-By: Stan Lo <stan.lo@shopify.com> https://github.com/ruby/irb/commit/d1fe234a9a
2022-11-03[ruby/irb] Require the entire irb lib in RubyLex testStan Lo
(https://github.com/ruby/irb/pull/428) RubyLex is not designed to be used alone. It's usually used with an IRB context, which requires workspace. So its tests should have access to those components too. https://github.com/ruby/irb/commit/608f261da4
2022-11-03[ruby/irb] Refactor RubyLex and its testsStan Lo
(https://github.com/ruby/irb/pull/427) * Make sure `RubyLex#set_input`'s context is always present in tests In real-world scenarios, the context should always be non-nil: https://github.com/ruby/irb/blob/master/lib/irb.rb#L489 So we should make sure our test setup reflects that. * Make context a required keyword Since in practice, `set_input`'s context should always be non-nil, its parameters should reflect that. And since `RubyLex#check_state` is only called by `#lex` and `#set_input`, both of which now always require context, we can assume its context should be non-nil too. https://github.com/ruby/irb/commit/1aeeb86203
2022-10-28[ruby/irb] Do not make non-existent XDG directory on startNobuyoshi Nakada
(https://github.com/ruby/irb/pull/357) https://github.com/ruby/irb/commit/298b134792
2022-10-28[ruby/irb] Update regarding NO_COLOR valueNobuyoshi Nakada
https://no-color.org has been updated (jcs/no_color#83): > Command-line software which adds ANSI color to its output by default should check for a `NO_COLOR` environment variable that, when present and **not an empty string** (regardless of its value), prevents the addition of ANSI color. https://github.com/ruby/irb/commit/46e0f7e370 Co-authored-by: Stan Lo <stan001212@gmail.com>
2022-10-28[ruby/irb] Suppress sequence to inspect asian ambiguous width Nobuyoshi Nakada
https://github.com/ruby/irb/commit/a7097c5b80