summaryrefslogtreecommitdiff
path: root/test/reline
AgeCommit message (Collapse)Author
2019-10-07Swap expected and actual correctlyaycabta
2019-09-25Make rb_scan_args handle keywords more similar to Ruby methods (#2460)Jeremy Evans
Cfuncs that use rb_scan_args with the : entry suffer similar keyword argument separation issues that Ruby methods suffer if the cfuncs accept optional or variable arguments. This makes the following changes to : handling. * Treats as **kw, prompting keyword argument separation warnings if called with a positional hash. * Do not look for an option hash if empty keywords are provided. For backwards compatibility, treat an empty keyword splat as a empty mandatory positional hash argument, but emit a a warning, as this behavior will be removed in Ruby 3. The argument number check needs to be moved lower so it can correctly handle an empty positional argument being added. * If the last argument is nil and it is necessary to treat it as an option hash in order to make sure all arguments are processed, continue to treat the last argument as the option hash. Emit a warning in this case, as this behavior will be removed in Ruby 3. * If splitting the keyword hash into two hashes, issue a warning, as we will not be splitting hashes in Ruby 3. * If the keyword argument is required to fill a mandatory positional argument, continue to do so, but emit a warning as this behavior will be going away in Ruby 3. * If keyword arguments are provided and the last argument is not a hash, that indicates something wrong. This can happen if a cfunc is calling rb_scan_args multiple times, and providing arguments that were not passed to it from Ruby. Callers need to switch to the new rb_scan_args_kw function, which allows passing of whether keywords were provided. This commit fixes all warnings caused by the changes above. It switches some function calls to *_kw versions with appropriate kw_splat flags. If delegating arguments, RB_PASS_CALLED_KEYWORDS is used. If creating new arguments, RB_PASS_KEYWORDS is used if the last argument is a hash to be treated as keywords. In open_key_args in io.c, use rb_scan_args_kw. In this case, the arguments provided come from another C function, not Ruby. The last argument may or may not be a hash, so we can't set keyword argument mode. However, if it is a hash, we don't want to warn when treating it as keywords. In Ruby files, make sure to appropriately use keyword splats or literal keywords when calling Cfuncs that now issue keyword argument separation warnings through rb_scan_args. Also, make sure not to pass nil in place of an option hash. Work around Kernel#warn warnings due to problems in the Rubygems override of the method. There is an open pull request to fix these issues in Rubygems, but part of the Rubygems tests for their override fail on ruby-head due to rb_scan_args not recognizing empty keyword splats, which this commit fixes. Implementation wise, adding rb_scan_args_kw is kind of a pain, because rb_scan_args takes a variable number of arguments. In order to not duplicate all the code, the function internals need to be split into two functions taking a va_list, and to avoid passing in a ton of arguments, a single struct argument is used to handle the variables previously local to the function. Notes: Merged-By: jeremyevans <code@jeremyevans.net>
2019-08-27Add test with encoding.manga_osyo
2019-08-27Change to test file path.manga_osyo
2019-08-27Refactoring Reline.manga_osyo
2019-08-27Fix reference core method.manga_osyo
2019-08-27Remove test_mode in `lib/reline`.manga_osyo
2019-08-18Remove commented out debug printaycabta
2019-08-18Don't crash when deleting at the end of the lineAlan Wu
To reproduce this bug, type one character into irb, then press the delete key on your keyboard.
2019-07-15Move a test file of Reline to test/reline/aycabta
2019-07-15Remove unused method.manga_osyo
2019-07-04Support Control- and Meta-aycabta
2019-07-04Check commented out line in inputrc correctlyaycabta
2019-07-04Parse key sequence more strictlyNobuyoshi Nakada
2019-07-04Skip indented comment lines [Bug #15981]Nobuyoshi Nakada
2019-06-08Remove unnecessary variablesaycabta
2019-06-06Skip transpose-words if less than 2 wordaycabta
2019-06-06Add test_ed_transpose_words_for_mbcharaycabta
2019-06-04Renamed duplicate testNobuyoshi Nakada
2019-06-04Add aliases for commands for changing text macroaycabta
2019-06-04Implement transpose-wordsaycabta
2019-06-03Use lines instead of splitKazuhiro NISHIYAMA
``` % cat ~/bench-split.yml prelude: | s = "foo\nbar\nbaz\n" benchmark: '/(?<=\n)/': | s.split(/(?<=\n)/) '/^/': | s.split(/^/) 'lines': | s.lines Warming up -------------------------------------- /(?<=\n)/ 459.123k i/s - 467.844k times in 1.018994s (2.18μs/i) /^/ 467.922k i/s - 469.744k times in 1.003894s (2.14μs/i) lines 2.343M i/s - 2.424M times in 1.034677s (426.84ns/i) Calculating ------------------------------------- /(?<=\n)/ 422.347k i/s - 1.377M times in 3.261232s (2.37μs/i) /^/ 477.603k i/s - 1.404M times in 2.939186s (2.09μs/i) lines 2.485M i/s - 7.028M times in 2.828757s (402.47ns/i) Comparison: lines: 2484631.6 i/s /^/: 477603.3 i/s - 5.20x slower /(?<=\n)/: 422346.5 i/s - 5.88x slower ```
2019-06-03The C-q is also quoted insert in emacs modeaycabta
2019-06-03Add aliases for commands for moving macroaycabta
2019-06-03Close leaked file descripters in testsaycabta
2019-06-03The ed_move_to_beg is different from vi_first_printaycabta
2019-06-03Fix ArgumentError in aliased macroNobuyoshi Nakada
Closes: https://github.com/ruby/ruby/pull/2221
2019-06-02Check conditional nestings in INPUTRCNobuyoshi Nakada
Closes: https://github.com/ruby/ruby/pull/2222
2019-06-02Use simpler regexpKazuhiro NISHIYAMA
2019-06-02Add true condition `Reline`Nobuyoshi Nakada
2019-06-02Add Reline test for unknown macroaycabta
2019-06-02Add new test for Reline within pipeaycabta
2019-06-01Reset Config at Reline::Config::Test#teardownaycabta
2019-06-01Use inputrc data for keystroke settingaycabta
2019-05-29Remove extra items because Reline::HISTORY is a sized queueaycabta
2019-05-29Revert 3b7862c8e88cd7838a53ec083ac5733386400956 causing various CI hangsTakashi Kokubun
and dependent commits c67934b1c3b40dda5f170b032423e520511c68dd and f0d1dc5cee87dfb023cb43a2db9bcdef5a8dee8f. RubyCI and ci.rvm.jp are almost dead by timeout since this commit. --- Revert "Skip a reline test hanging on Wercker since 3b7862c8e8" This reverts commit f0d1dc5cee87dfb023cb43a2db9bcdef5a8dee8f. Revert "Remove extra items because Reline::HISTORY is a sized queue" This reverts commit c67934b1c3b40dda5f170b032423e520511c68dd. Revert "Use existing instances for LineEditor and Config" This reverts commit 3b7862c8e88cd7838a53ec083ac5733386400956.
2019-05-29Remove extra items because Reline::HISTORY is a sized queueaycabta
2019-05-29Use existing instances for LineEditor and Configaycabta
2019-05-28Use Reline.completer_quote_characters to completeaycabta
2019-05-24Support Meta key in Relineaycabta
2019-05-22Use Reline.test_mode in Reline's test tooaycabta
2019-05-21Support DEL keyaycabta
2019-05-14Rename Reline's test file name because of typoaycabta
2019-05-14Check encoding when Readline completionaycabta
2019-05-13Add ed_search_prev_history to Relineaycabta
2019-05-13Use LineEditor#reset on testaycabta
2019-05-12Revert "Add a test for em_capitol_case of Reline"aycabta
This reverts commit b1767e56b158d8307412a0928a7ac2366541429d.
2019-05-12Add a test for em_capitol_case of Relineaycabta
2019-05-01Silence a (probable) debug printNobuyoshi Nakada
2019-04-30Use Encoding::UTF_8 if RELINE_TEST_ENCODING doesn't existaycabta