aboutsummaryrefslogtreecommitdiffstats
path: root/test/irb
Commit message (Collapse)AuthorAgeFilesLines
* [ruby/irb] Move assignment check to RubyLexStan Lo2023-08-112-53/+54
| | | | | | | | | | (https://github.com/ruby/irb/pull/670) Since assignment check relies on tokenization with `Ripper`, it feels like the responsibility of `RubyLex`. `Irb#eval_input` should simply get the result when calling `each_top_level_statement` on `RubyLex`. https://github.com/ruby/irb/commit/89d1adb3fd
* [ruby/irb] Skip integration tests in core CIStan Lo2023-08-113-12/+4
| | | | | | | | | | | | | | | | (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. https://github.com/ruby/irb/commit/6f49b4c108
* [ruby/irb] Don't echo an expression's result when it ends with aStan Lo2023-08-112-1/+44
| | | | | | | semicolon (https://github.com/ruby/irb/pull/669) https://github.com/ruby/irb/commit/50185c2833
* [ruby/irb] Skip nested IRB tests in Ruby Core CIStan Lo2023-08-091-0/+8
| | | | | | | | | | (https://github.com/ruby/irb/pull/675) Sometimes the subprocess gets stuck in the nested IRB session until timed out. We don't have enough information to debug it yet, so skip the tests to unblock CI. https://github.com/ruby/irb/commit/606f18c80c
* [ruby/irb] Fix nested IRB sessions' history savingStan Lo2023-08-091-1/+87
| | | | | | | | | | | | | | | | (https://github.com/ruby/irb/pull/652) 1. Dynamically including `HistorySavingAbility` makes things unnecessarily complicated and should be avoided. 2. Because both `Reline` and `Readline` use a single `HISTORY` constant to store history data. When nesting IRB sessions, only the first IRB session should handle history loading and saving so we can avoid duplicating history. 3. History saving callback should NOT be stored in `IRB.conf` as it's recreated every time `IRB.setup` is called, which would happen when nesting IRB sessions. https://github.com/ruby/irb/commit/0fef0ae160
* [ruby/irb] Remove unused `InputMethod#initialize`Stan Lo2023-08-071-1/+0
| | | | | | | | | | | | | | | | | (https://github.com/ruby/irb/pull/635) * Remove unused InputMethod#initialize The constructor takes a `file_name` argument, but it is never used. The only input method that needs a file is `FileInputMethod`, which has its own constructor to take a file object directly. So the constructor in `InputMethod` is not needed and its child classes don't need to call `super` in their constructors. * Remove unused FileInputMethod#file_name https://github.com/ruby/irb/commit/153b1e9d1c
* [ruby/irb] Store integration tests' envs in an ivarStan Lo2023-08-042-11/+7
| | | | | | (https://github.com/ruby/irb/pull/668) https://github.com/ruby/irb/commit/bbd20445ea
* [ruby/irb] Fix IntegrationTestCaseStan Lo2023-08-041-1/+1
| | | | | | (https://github.com/ruby/irb/pull/667) https://github.com/ruby/irb/commit/79fc6dcf5f
* [ruby/irb] Extract integration testing helpers out of debug commandStan Lo2023-08-022-103/+113
| | | | | | | | | | | 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. https://github.com/ruby/irb/commit/73b7a895f8
* [ruby/irb] Page `ls`'s output (https://github.com/ruby/irb/pull/657)Stan Lo2023-07-262-0/+58
| | | | | | | | * Page ls command's output * Use Pager.page_content in show_cmds too https://github.com/ruby/irb/commit/82d1687302
* [ruby/irb] Display `show_cmds`'s output in a pager when in TTYStan Lo2023-07-252-0/+28
| | | | | | | | | | | | | environment (https://github.com/ruby/irb/pull/647) This can: - Make it easier to scroll up and down the commands list - Avoid pushing up users' previous output - Allow users to do basic search with `/<word>` https://github.com/ruby/irb/commit/f94e8a66dd
* [ruby/irb] Reduce boilerplate code in RubyLexTestStan Lo2023-07-181-460/+337
| | | | | | | | | | | | (https://github.com/ruby/irb/pull/644) * Avoid initialising Row at every test input * Extract common assertion patterns into methods * Remove unnecessary PromptRow strcut and boilerplate code https://github.com/ruby/irb/commit/1ba586c0c6
* [ruby/irb] Indent multiline percent literalstomoya ishida2023-07-151-17/+17
| | | | | | (https://github.com/ruby/irb/pull/643) https://github.com/ruby/irb/commit/18bb4022a9
* [ruby/irb] Unpend RDoc dialog related testsStan Lo2023-07-131-10/+22
| | | | | | | | | | | | | | | (https://github.com/ruby/irb/pull/640) * Unpend rdoc dialog tests Without these tests, we don't have any coverage on autocompletion's rdoc dialog, which is what caused #638 to happen. * Pull ri doc on CI for the doc dialog test * Assert different screen result on CI and local machine https://github.com/ruby/irb/commit/3ac96be660
* [ruby/irb] Refactor eval historyStan Lo2023-07-041-0/+68
| | | | | | | | | | | | (https://github.com/ruby/irb/pull/623) * Rename `ext/history.rb` to `ext/eval_history.rb` To confusion with `lib/irb/history.rb` * Add eval_history tests * Rename eval_history's History to EvalHistory to avoid confusion
* [ruby/irb] Stop treating history-saving logic as extensionStan Lo2023-07-031-1/+0
| | | | | | | | (https://github.com/ruby/irb/pull/613) Since `IRB.conf[:SAVE_HISTORY]` is assigned with 1000 by default, history-saving is a feature enabled by default. So it should not be treated as an extension, which adds unnecessary complexity to the code.
* [ruby/irb] Reduce internal operations' exposure to benchmarkingStan Lo2023-06-301-0/+28
| | | | | | | | | | | | | | | | | | | | | (https://github.com/ruby/irb/pull/618) * Test last value is assigned with measure enabled * Remove unnecessary `result` variable `Context#evaluate` always assigns the result of the evaluation to `_` so we don't need to do it in `Irb#eval_input`. * Move benchmarking logic into `Context#evaluate` Current location of the benchmarking logic is too high up and includes operations like command loading and argument transformation, which should be excluded. So this commit moves it into `Context#evaluate` to reduce the noise. We don't move it further down to `Workspace#evaluate` because `Context` is an argument of the measure block, which is not available in `Workspace`.
* [ruby/irb] Re-implement prev_spaces feature for pasted codetomoya ishida2023-06-301-0/+57
| | | | | | (https://github.com/ruby/irb/pull/607) https://github.com/ruby/irb/commit/9d97a192a5
* [ruby/irb] Reduce test pend trufflerubytomoya ishida2023-06-282-5/+0
| | | | | | (https://github.com/ruby/irb/pull/619) https://github.com/ruby/irb/commit/b7b071774f
* [ruby/irb] Remove keyword exception from Context#evaluate becausetomoya ishida2023-06-271-14/+0
| | | | | | | the value is always nil (https://github.com/ruby/irb/pull/617) https://github.com/ruby/irb/commit/62691384f8
* [ruby/irb] Always add \n at the end of the test input in RubyLextomoya ishida2023-06-271-5/+5
| | | | | | | test (https://github.com/ruby/irb/pull/614) https://github.com/ruby/irb/commit/e68c6128aa
* [ruby/irb] Fix process_continue(rename to should_continue?) andtomoya ishida2023-06-251-9/+47
| | | | | | | check_code_block(rename to check_code_syntax) (https://github.com/ruby/irb/pull/611) https://github.com/ruby/irb/commit/b7f4bfaaa4
* [ruby/irb] Omit nesting_level, use indent_level to build prompttomoya ishida2023-06-241-49/+49
| | | | | | | string (https://github.com/ruby/irb/pull/610) https://github.com/ruby/irb/commit/f01ff0811b
* [ruby/irb] Improve indentation: bugfix, heredoc, embdoc, stringstomoya ishida2023-06-202-134/+153
| | | | | | | | | | | | (https://github.com/ruby/irb/pull/515) * Implement heredoc embdoc and string indentation with bugfix * Fix test_ruby_lex's indentation value * Add embdoc indent test * Add workaround for lines==[nil] passed to auto_indent when exit IRB with CTRL+d
* [ruby/irb] Add missing token that ignored by rippertomoya ishida2023-06-191-0/+21
| | | | | | (https://github.com/ruby/irb/pull/608) https://github.com/ruby/irb/commit/1cd3b45402
* [ruby/irb] Rewrite RubyLex to fix some bugs and make it possible totomoya ishida2023-06-152-51/+338
| | | | | | | | | | | | | | | | | | | add new features easily (https://github.com/ruby/irb/pull/500) * Add nesting level parser for multiple use (indent, prompt, termination check) * Rewrite RubyLex using NestingParser * Add nesting parser tests, fix some existing tests * Add description comment, rename method to NestingParser * Add comments and tweak code to RubyLex * Update NestingParser test * Extract list of ltype tokens to constants
* [ruby/irb] Stanardise test class names with `Test` postfix insteadStan Lo2023-06-1311-17/+17
| | | | | | | of prefix (https://github.com/ruby/irb/pull/603) https://github.com/ruby/irb/commit/359cb28def
* [ruby/irb] Use symbol.inspect instead of ":"+symbol.id2name to avoidtomoya ishida2023-06-131-3/+5
| | | | | | | completion candidates including newline characters (https://github.com/ruby/irb/pull/539) https://github.com/ruby/irb/commit/aaf0c46645
* [ruby/irb] Fixed string escaping omissionsima1zumi2023-06-051-0/+1
| | | | | | | (https://github.com/ruby/irb/pull/599) I received a `RegexpError` when I typed `::Array[`. ::Array[/Users/mi/ghq/github.com/ruby/irb/lib/irb/completion.rb:236:in `retrieve_completion_data': premature end of char-class: /^Array[/ (RegexpError)
* [ruby/irb] Require `test/lib` helpers from main test helperStan Lo2023-06-022-5/+1
| | | | | | (https://github.com/ruby/irb/pull/595) Because they are handled differently in `ruby/irb` and `ruby/ruby`.
* [ruby/irb] Improve debug command testsStan Lo2023-06-011-8/+2
| | | | | | | | | | | | (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
* [ruby/irb] Allow `show_source` for private methodsTSUYUSATO Kitsune2023-05-231-0/+41
| | | | | | | | | | | | | | | | (https://github.com/ruby/irb/pull/589) * Allow `show_source` for private methods Fix https://github.com/ruby/irb/pull/577 * Pend tests on TruffleRuby It seems `eval(..., __LINE__ + 1)` does not work. Other similar tests are also pended on TruffleRuby, so I think it is acceptable. * Use `private_method_defined?` instead of `defined?`
* [ruby/irb] Fix typo (https://github.com/ruby/irb/pull/587)ima1zumi2023-05-211-4/+4
| | | | | | | | | | | | | | * Fix typo * s/braking/breaking/g Co-authored-by: Stan Lo <stan001212@gmail.com> --------- https://github.com/ruby/irb/commit/5f8e69f5f2 Co-authored-by: Stan Lo <stan001212@gmail.com>
* [ruby/irb] Add assertion for dynamic_prompt's assertion executionStan Lo2023-05-201-0/+3
| | | | | | | | | | (https://github.com/ruby/irb/pull/586) Because the assertions for `dynamic_prompt` lives inside a block given to `RubyLex`, they could be skipped unnoticed if the setup is not correct. This commit adds a simple assertion to check if the block was actually executed.
* [ruby/irb] Fix dynamic_prompt test not executed, remove unnecessarytomoya ishida2023-05-201-2/+1
| | | | | | | set_input (https://github.com/ruby/irb/pull/585) https://github.com/ruby/irb/commit/b5f3efdcf0
* [ruby/irb] Simplify each_top_level_statementtomoya ishida2023-05-191-12/+7
| | | | | | | | | | | | | | | | | | | | | | (https://github.com/ruby/irb/pull/576) * Simplify each_top_level_statement, reduce instance vars * Update lib/irb/ruby-lex.rb Co-authored-by: Stan Lo <stan001212@gmail.com> * Remove unused ltype from TestRubyLex#check_state response * Remove unnecessary const path of TerminateLineInput * Combine duplicated code state check into method --------- https://github.com/ruby/irb/commit/172453cec4 Co-authored-by: Stan Lo <stan001212@gmail.com>
* [ruby/irb] Refactor RubyLex's input/io methodsStan Lo2023-05-181-4/+4
| | | | | | | | | (https://github.com/ruby/irb/pull/583) 1. Make `RubyLex#set_input` simply assign the input block. This matches the behavior of `RubyLex#set_prompt`. 2. Merge `RubyLex#set_input`'s IO configuration logic with `#set_auto_indent` into `#configure_io`.
* [ruby/irb] Print deprecation warning for `help` commandStan Lo2023-05-181-12/+26
| | | | | | | | (https://github.com/ruby/irb/pull/567) * Give show_doc its own command class * Print deprecation warning for `help` command
* [ruby/irb] Fix Test timedout in test_debug_cmdtomoya ishida2023-05-171-2/+5
| | | | | | | | (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
* [ruby/irb] Use a more tolerant way to check Locale#find's returnStan Lo2023-04-261-4/+4
| | | | | | | path (https://github.com/ruby/irb/pull/572) https://github.com/ruby/irb/commit/0b648adf38
* [ruby/irb] Add tests for Locale#find and Locale#loadStan Lo2023-04-261-0/+35
| | | | | | (https://github.com/ruby/irb/pull/570) https://github.com/ruby/irb/commit/710d5b1af5
* [ruby/irb] Fix Locale's encoding lookup for Japanese encodingsStan Lo2023-04-261-2/+2
| | | | | | | | | | | | | | (https://github.com/ruby/irb/pull/568) In https://github.com/ruby/irb/commit/3ee79e89adb8e21b63d796e53bcc86281685076d, `encoding_aliases.rb` was introduced to return the correct encoding object for `ujis` and `euc` encodings. However, the return value of `@@legacy_encoding_alias_map[@encoding_name]` is always overridden by a second look up with `Encoding.find(@encoding_name)`. So the logic didn't work as expected. This commit fixes the problem.
* Revert "Temporary skipped failing assertions"Hiroshi SHIBATA2023-04-261-2/+2
| | | | This reverts commit e7cdce83e8c8797c481ccb54c260c0db1e1afa7c.
* Temporary skipped failing assertionsHiroshi SHIBATA2023-04-251-2/+2
|
* [ruby/irb] Add tests for Locale classStan Lo2023-04-251-0/+83
| | | | | | (https://github.com/ruby/irb/pull/566) https://github.com/ruby/irb/commit/df32e024be
* [ruby/irb] Simplify the help command's implementationStan Lo2023-04-241-3/+5
| | | | | | | | | | | | (https://github.com/ruby/irb/pull/564) The current method-redefining approach brings little benefit, makes it harder to understand the code, and causes warnings like: > warning: method redefined; discarding old execute This patch simplifies it while displaying more helpful message when rdoc couldn't be loaded.
* [ruby/irb] Filter out top-level methods when using `lsStan Lo2023-04-241-1/+4
| | | | | | | | | <Class/Module>` (https://github.com/ruby/irb/pull/562) Instead of always printing methods inherited from Class or Module, IRB by default should filter them out unless `<Class/Module>` is specified to be either of those.
* [ruby/irb] Fix RubyLex's heredoc_with_hembexpr test to avoid rippertomoya ishida2023-04-071-3/+3
| | | | | | | tokenizing issue (https://github.com/ruby/irb/pull/558) https://github.com/ruby/irb/commit/f68e891ed1
* [ruby/irb] Drop Ruby 2.6 supportStan Lo2023-04-055-64/+7
| | | | | | | | | | | | | | (https://github.com/ruby/irb/pull/555) * Remove all Ruby 2.6 support * Drop Ruby 2.6 specific testing conditions * Only run Ruby 2.7+ on CI * Bump Ruby requirement to 2.7+ https://github.com/ruby/irb/commit/3f714b616c
* [ruby/irb] Don't check RUBY_ENGINE when deciding whether to accept kargsStan Lo2023-04-021-2/+0
| | | | | | | | | | Ruby implementations like JRuby and TruffleRuby already indicate their compatibility target with RUBY_VERSION. We don't need to exclude them from accepting keyword arguments as long as they target 2.7+. https://github.com/ruby/irb/commit/bf20faa4e6 Co-authored-by: Kevin Menard <kevin@nirvdrum.com>