summaryrefslogtreecommitdiff
path: root/test/irb
AgeCommit message (Collapse)Author
2024-01-23Fixup 2e69137dbe9fd7c03dac9b8adc30a7eba3ecb10bHiroshi SHIBATA
2024-01-22Use version dependant library for completion testHiroshi SHIBATA
2024-01-08[ruby/irb] Make SourceFinder ignore binary sourcesStan Lo
(https://github.com/ruby/irb/pull/836) https://github.com/ruby/irb/commit/73b35bb7f4
2024-01-03[ruby/irb] Avoid completing empty inputStan Lo
(https://github.com/ruby/irb/pull/832) The candidate list for empty input is all methods + all variables + all constants + all keywords. It's a long list that is not useful. https://github.com/ruby/irb/commit/812dc2df7b
2024-01-01[ruby/irb] Make show_source resolve top-level constant namesStan Lo
(https://github.com/ruby/irb/pull/831) https://github.com/ruby/irb/commit/5843616c78
2024-01-01[ruby/irb] Fix display_document params in noautocomplete modetomoya ishida
(https://github.com/ruby/irb/pull/826) * Fix display_document params in noautocomplete mode * Fix wrong preposing and target order in display_document The fixed wrong-ordered value is not used in RegexpCompletor, so this change does not affect the test. https://github.com/ruby/irb/commit/08208adb5e
2024-01-01[ruby/irb] test_recovery_sigint: Ensure precondition is metSorah Fukumori
(https://github.com/ruby/irb/pull/829) * test_recovery_sigint: Ensure precondition is met test_recovery_sigint depends on its process has SIG_DEF sigaction for SIGINT. When its parent process set SIG_IGN which inherits to children, then this test fails. This patch ensures this precondition met regardless of inherited sigaction from its parent. * Add test for restoration of other SIGINT handlers Add another variant of test_recovery_sigint to ensure IRB to preserve existing SIGINT handler other than SIG_DEF. https://github.com/ruby/irb/commit/77ee59d026
2024-01-01[ruby/irb] Remove redundant env cleanup in rendering testStan Lo
(https://github.com/ruby/irb/pull/827) https://github.com/ruby/irb/commit/99b0017d75
2023-12-20[ruby/irb] Warn users about errors in loading RC filesStan Lo
(https://github.com/ruby/irb/pull/817) 1. Because `IRB.rc_file` always generates an rc file name, even if the file doesn't exist, we should check the file exists before trying to load it. 2. If any type of errors occur while loading the rc file, we should warn the user about it. https://github.com/ruby/irb/commit/37ffdc6b19
2023-12-13[ruby/irb] Remove unused lvar in mesure command testtomoya ishida
(https://github.com/ruby/irb/pull/814) https://github.com/ruby/irb/commit/320178b120
2023-12-13[ruby/irb] Warn and do nothing if block is passed to measure commandtomoya ishida
(https://github.com/ruby/irb/pull/813) https://github.com/ruby/irb/commit/e79a90a1e6
2023-12-12Save $VERBOSE properlyNobuyoshi Nakada
2023-12-12Prevent a warning: setting Encoding.default_externalYusuke Endoh
2023-12-10[ruby/irb] Simplify show_source's super calculationStan Lo
(https://github.com/ruby/irb/pull/807) https://github.com/ruby/irb/commit/2cccc448de
2023-12-03[ruby/irb] Disable pager in eval_history testtomoya ishida
(https://github.com/ruby/irb/pull/799) https://github.com/ruby/irb/commit/ee85e84935
2023-12-02[ruby/irb] Implement `history` commandGary Tou
(https://github.com/ruby/irb/pull/761) * Implement `history` command Lists IRB input history with indices. Also aliased as `hist`. * Add tests for `history` command * Address feedback: `puts` with multiple arguments instead of `join`ing * Address feedback: Handle nil from splitting an empty input string * Refactor line truncation * Add `-g` grep option to `history` command * Add `history` command to README * Remove unused `*args` parameter * Allow spaces to be included in grep * Allow `/` to be included in grep regex * Handle `input` being an empty string * Exclude "#{index}: " from matching the grep regex * Add new line after joining https://github.com/ruby/irb/commit/3f9eacbfa9
2023-12-01[ruby/irb] Scrub past history input before splithogelog
(https://github.com/ruby/irb/pull/795) * Scrub past history input before split * Don't rewrite ENV["LANG"] https://github.com/ruby/irb/commit/0f344f66d9
2023-11-30[ruby/irb] Page evaluation result's outputStan Lo
(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. https://github.com/ruby/irb/commit/4fedce93d3
2023-11-29[ruby/irb] Use gem repl_type_completor, remove type_completiontomoya ishida
implementation (https://github.com/ruby/irb/pull/772) https://github.com/ruby/irb/commit/a4868a5373
2023-11-28[ruby/irb] Change show_source tests into integration testsPeter Zhu
* Remove trailing spaces * Migrate show_source tests to integration tests Because show_source tests often need to define class and/or methods, they can easily leak state to other tests. Changing them to integration tests will ensure that they are run in a clean environment. * Fix NoMethodError caused by SourceFinder#method_target https://github.com/ruby/irb/commit/3c39f13397c72a8db24e50afdcb8942e6c4ea12f
2023-11-28[ruby/irb] This enhancement allows a user to add the -s flag if theypaulreece
want to access a methods origin definition. It allows for chaining of multiple esses to further go up the classes as needed. (https://github.com/ruby/irb/pull/770) https://github.com/ruby/irb/commit/eec1329d5a
2023-11-28[ruby/irb] Rescue errors from main.to_s/inspect when formattingKasumi Hanazuki
prompt (https://github.com/ruby/irb/pull/791) Currently, IRB just terminates if `main.to_s` raises while IRB constructs the prompt string. This can easily happen if the user wants to start an IRB session in the instance scope of an uninitialized object, for example: ``` class C def initialize binding.irb @values = [] end def to_s = @values.join(',') # raises if uninitialized end C.new ``` This patch makes IRB rescue from such an exception and displays the class name of the exception instead of `main.to_s` to indicate some error has occurred. We may display more detailed information about the exception, but this patch chooses not to do so because 1) the prompt has limited space, 2) users can evaluate `to_s` in IRB to examine the error if they want, and 3) obtaining the details can also raise, which requires nested exception handling and can be complicated. https://github.com/ruby/irb/commit/412ab26067
2023-11-27[ruby/irb] Hide debugger hint after the input is submittedStan Lo
(https://github.com/ruby/irb/pull/789) If `output_modifier_proc`'s `complete` arg is true, it means the input is submitted. In that case, debugger hint doesn't provide value to users and adds noise to the output. So we hide it in such case. https://github.com/ruby/irb/commit/f86d9dbe2f
2023-11-26[ruby/irb] Display aliases in help messageStan Lo
(https://github.com/ruby/irb/pull/788) Similar to Pry, it displays user-defined aliases in the help message with a dedicated section. With the current default aliases, it looks like: ``` ...other sections... Aliases $ Alias for `show_source` @ Alias for `whereami` ``` https://github.com/ruby/irb/commit/2a0eacc891
2023-11-26[ruby/irb] Support disabling pagerStan Lo
(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. https://github.com/ruby/irb/commit/df1c3b9042
2023-11-25[ruby/irb] Fix exception(backtrace=nil) prints nothingtomoya ishida
(https://github.com/ruby/irb/pull/782) https://github.com/ruby/irb/commit/fa9ecf9a5b
2023-11-25[ruby/irb] Fix flaky test casehogelog
test_autocomplete_with_multiple_doc_namespaces (https://github.com/ruby/irb/pull/786) https://github.com/ruby/irb/commit/85c6ddeb7d
2023-11-23[ruby/irb] Handle handle_exception's exceptiontomoya ishida
(https://github.com/ruby/irb/pull/780) https://github.com/ruby/irb/commit/d42138c477
2023-11-23[ruby/irb] Hint debugger command in irb:rdbg sessionStan Lo
(https://github.com/ruby/irb/pull/768) When user enters irb:rdbg session, they don't get the same hint that the `debug` gem provides, like ``` (rdbg) n # next command ``` This means that users may accidentally execute commands when they want to retrieve the value of a variable. So this commit adds a Reline output modifier to add a simiar hint: ``` irb:rdbg(main):002> n # debug command ``` It is not exactly the same as `debug`'s because in this case the importance is to help users distinguish between value evaluation and debugger command execution. https://github.com/ruby/irb/commit/fdf24de851
2023-11-21[ruby/irb] Enable Setting Completer Type through `IRB_COMPLETOR`ima1zumi
(https://github.com/ruby/irb/pull/771) I propose introducing the capability to set the IRB completion kinds via an environment variable, specifically `IRB_COMPLETOR=type`. This feature aims to enhance the Rails console experience by allowing Rails users to specify their preferred completion more conveniently. Currently, when using the Rails console, there's no straightforward way to globally set the type completion across a Rails application repository. It's possible to configure this setting by placing a `.irbrc` file at the project root. However, using a .irbrc file is not ideal as it allows for broad configurations and can potentially affect the production environment. My suggestion focuses on allowing users to set the completion to 'type' in a minimal. This enhancement would be particularly beneficial for teams writing RBS in their Rails applications. This type completer, integrated with RBS, would enhance completion accuracy, improving the Rails console experience. https://github.com/ruby/irb/commit/032f6da25f
2023-11-18[ruby/irb] Fix irb crash on `{}.` completiontomoya ishida
(https://github.com/ruby/irb/pull/764) https://github.com/ruby/irb/commit/07e4d540cc
2023-11-15Fix IRB tests (#8925)Hiroshi SHIBATA
* Revert "Fixup da2c2931a60" This reverts commit e1978a905a32af2d48b6e9efb6d0fe1656fddc5b. * Revert "Skip Type completion tests related with IRB::VERSION" This reverts commit da2c2931a602da22bc1fd10dc41f5c3a117bf502. * require irb/version to test IRB::VERSION --------- Co-authored-by: tompng <tomoyapenguin@gmail.com>
2023-11-15Fixup da2c2931a60Hiroshi SHIBATA
2023-11-15Skip Type completion tests related with IRB::VERSIONHiroshi SHIBATA
2023-11-15Revert "Tests of irb is still broken."Hiroshi SHIBATA
This reverts commit 5398bbcbab702907430ee019d07f5dcf2b0ce4af. We explicitly load rubygems at rubygems_ext.rb https://github.com/rubygems/rubygems/commit/8840d8507be72ff32bcbbdfb14e0b54efb364ffa
2023-11-10Tests of irb is still broken.Hiroshi SHIBATA
Revert "[ruby/irb] Revert "Skip TypeCompletion test in ruby ci" This reverts commit 589e2b6782f17d5a1d55021c0395d5d73224e9da.
2023-11-10[ruby/irb] Revert "Skip TypeCompletion test in ruby ciHiroshi SHIBATA
(https://github.com/ruby/irb/pull/748)" (https://github.com/ruby/irb/pull/755) This reverts commit https://github.com/ruby/irb/commit/d394af0bbce4. https://github.com/ruby/irb/commit/a9d0145115
2023-11-09[ruby/irb] Add command line option to select which completor to usetomoya ishida
(https://github.com/ruby/irb/pull/754) * Add command line option to select which completor to use * Add test for completor argv https://github.com/ruby/irb/commit/1dec2708c9
2023-11-08[ruby/irb] Skip TypeCompletion test in ruby citomoya ishida
(https://github.com/ruby/irb/pull/748) https://github.com/ruby/irb/commit/d394af0bbc
2023-11-08[ruby/irb] Type based completion using Prism and RBStomoya ishida
(https://github.com/ruby/irb/pull/708) * Add completor using prism and rbs * Add TypeCompletion test * Switchable completors: RegexpCompletor and TypeCompletion::Completor * Add completion info to irb_info * Complete reserved words * Fix [*] (*) {**} and prism's change of KeywordParameterNode * Fix require, frozen_string_literal * Drop prism<=0.16.0 support * Add Completor.last_completion_error for debug report * Retrieve `self` and `Module.nesting` in more safe way * Support BasicObject * Handle lvar and ivar get exception correctly * Skip ivar reference test of non-self object in ruby < 3.2 * BaseScope to RootScope, move method objects constant under Methods * Remove unused Splat struct * Drop deeply nested array/hash type calculation from actual object. Now, calculation depth is 1 * Refactor loading rbs in test, change preload_in_thread not to cache Thread object * Use new option added in prism 0.17.1 to parse code with localvars * Add Prism version check and warn when :type completor cannot be enabled * build_type_completor should skip truffleruby (because endless method definition is not supported) https://github.com/ruby/irb/commit/1048c7ed7a
2023-10-30[ruby/irb] Use IRB's own doc for doc dialog testsStan Lo
(https://github.com/ruby/irb/pull/743) * Use IRB's own doc for doc dialog tests * Run doc dialog tests for older Rubies too * Remove unnecessary CI setups https://github.com/ruby/irb/commit/97a2b86f0a
2023-10-21[ruby/irb] Minor refactors around irb.rbStan Lo
(https://github.com/ruby/irb/pull/736) * Remove dead method * Simplify IRB.version * Move private Irb methods together * Centralise @CONF initialization/assignment in init.rb * Move attr_* calls above initialize method https://github.com/ruby/irb/commit/cf23be4395
2023-10-16[ruby/irb] Suppress "Switch to inspect mode" messagesNobuyoshi Nakada
This message is displayed if STDIN is not a tty. The parallel test is the case. https://github.com/ruby/irb/commit/e26e90e3fb
2023-10-14[ruby/irb] Restore encoding in InputCompletor testtomoya ishida
(https://github.com/ruby/irb/pull/732) https://github.com/ruby/irb/commit/ef77c232cf
2023-10-14[ruby/irb] Restore IRB::InputCompletor for compatibilitytomoya ishida
(https://github.com/ruby/irb/pull/730) https://github.com/ruby/irb/commit/77265efc5f
2023-10-12[ruby/irb] Fix require path completion disturbing string methodtomoya ishida
completion (https://github.com/ruby/irb/pull/726) https://github.com/ruby/irb/commit/e42dc74ce0
2023-10-12[ruby/irb] Fix test runner exit bugtomoya ishida
(https://github.com/ruby/irb/pull/728) * Remove useless test setup and teardown that sets MAIN_CONTEXT to nil * Avoid adding command methods to main object in test https://github.com/ruby/irb/commit/f204829a08
2023-10-12[ruby/irb] Decouple RubyLex from prompt and line_notomoya ishida
(https://github.com/ruby/irb/pull/701) * Remove instance variable prompt and line_no from RubyLex * Fix prompt test * Rename prompt generating method and make it private https://github.com/ruby/irb/commit/1ceb97fe2e
2023-10-11[ruby/irb] Rename current completor to RegexpCompletor andtomoya ishida
refactored for future extension (https://github.com/ruby/irb/pull/707) * Move completion implementation to completion/regexp_completor for future extension * Remove constant CompletionProc and PerfectMatchedProc and add a class method * Move document display logic to InputCompletor. Each completor only need to implement `completion_caididates` and `doc_namespace` * Move display_document logic to RelineInputMethod * Use RegexpCompletor directly. Not through class method of InputCompletor. * RegexpCompletor extends BaseCompletor, move back definition to completion.rb * Move display_document test to input_method test * Stop re-initialize completor on each completion phase * Store completor to ReadlineInputMethod's iver https://github.com/ruby/irb/commit/1e98521483
2023-10-04[ruby/irb] Clear all context usages in RubyLexStan Lo
(https://github.com/ruby/irb/pull/684) After this change, `RubyLex` will not interact with `Context` directly in any way. This decoupling has a few benefits: - It makes `RubyLex` easier to test as it no longer has a dependency on `Context`. We can see this from the removal of `build_context` from `test_ruby_lex.rb`. - It will make `RubyLex` easier to understand as it will not be affected by state changes in `Context` objects. - It allows `RubyLex` to be used in places where `Context` is not available. https://github.com/ruby/irb/commit/d5b262a076