summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2019-06-01Reset Config at Reline::Config::Test#teardownaycabta
2019-06-01Use inputrc data for keystroke settingaycabta
2019-06-01Fix FrozenError when assigning frozen class to constantNobuyoshi Nakada
* variable.c (set_namespace_path): modules/classes can get named by assignment to constant, even if frozen. [Bug #15891]
2019-05-31Keep vm->orig_progname aliveAlan Wu
`vm->orig_progname` can be different from `vm->progname` when user code assigns to `$0`. While `vm->progname` is kept alive by the global table, nothing marked `vm->orig_progname`. [Bug #15887]
2019-05-30Fix visibility of some methods when using DelegateClassJeremy Evans
Public instance methods added to a delegated class after the creation of the delegate class were not returned by the public_instance_methods class method of the delegate class. Protected instance methods in the delegated class when the delegate class is created were returned by the public_methods instance method of the delegate class. Patch mostly from Kenichi Kamiya <kachick1@gmail.com> in GitHub pull request 926. Minor changes to get it to apply, and to fix tests after applying by me. Fixes [Bug #11512]
2019-05-30Allow DelegateClass() to module_eval given blockJeremy Evans
Methods that return classes often module_eval the given block (e.g. Class.new and Struct.new). This allows DelegateClass to work similarly. This makes it easier to use DelegateClass directly without subclassing, so as not to create an unnecessary subclass. Implements [Feature #15842]
2019-05-31Warn compile_error only when input is finishedTakashi Kokubun
Let's say we are in progress to write `"foo"`: ``` irb> "fo ``` at this moment, nothing is wrong. It would be just a normal way to write `"foo"`. Prior to this commit, the `fo` part was warned because of 5b64d7ac6e7cbf759b859428f125539e58bac0bd. But I think warning such a normal input is not valuable for users. However, we'd like to warn `:@1` or `@@1` which is also a syntax error. Then this commit switches the syntax highlight based on whether the input text is finished or not. When it's not finished yet, it does not warn compile_error.
2019-05-30parse.y: adjust here-doc error tokenNobuyoshi Nakada
* parse.y (here_document): adjust token to the here-doc identifier in compile_error when a here-document misses the closing identifier.
2019-05-30Include stack elements left after errorsNobuyoshi Nakada
2019-05-30parse.y: continue after heredoc errorNobuyoshi Nakada
* parse.y: continue parsing the rest of the here-document starting line, after the terminator was not found.
2019-05-29Colorize errors moreNobuyoshi Nakada
* lib/irb/color.rb (IRB::Color.colorize_code): colorize `compile_error` part as same as `on_parse_error`.
2019-05-29parse.y: fix state after ivar/cvarNobuyoshi Nakada
* parse.y (parse_atmark): return EXPR_END or EXPR_ENDFN, depending on the previous state, even incomplete names consistently.
2019-05-29Colorize compile_error as same as on_parse_errorNobuyoshi Nakada
2019-05-29parse.y: flush invalid charNobuyoshi Nakada
2019-05-29test/rubygems/test_gem_stream_ui.rb (test_ask_for_password): extend the timeoutYusuke Endoh
for Solaris. https://rubyci.org/logs/rubyci.s3.amazonaws.com/unstable10s/ruby-master/log/20190528T191908Z.fail.html.gz
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-29Skip a reline test hanging on Wercker since 3b7862c8e8Takashi Kokubun
like https://app.wercker.com/ruby/ruby/runs/mjit-test1/5cedad11105780001c4e7001?step=5cedaf6b48fad200076fe77b
2019-05-29Remove extra items because Reline::HISTORY is a sized queueaycabta
2019-05-29Use existing instances for LineEditor and Configaycabta
2019-05-29parse.y: warn escaped whitespaceNobuyoshi Nakada
* parse.y (warn_space_char_code): warn whitespace characters escaped with meta/control prefix.
2019-05-28Update the certificate files to make the test pass on Debian 10Yusuke Endoh
The old certificate files (for example, test/rubygems/ca_cert.pem) were signed by SHA1. This message digest is considered too weak and rejected by OpenSSL 1.1.1 or later. Because of this, the test suite does not pass on Debian 10. https://rubyci.org/logs/rubyci.s3.amazonaws.com/debian/ruby-master/log/20190527T123003Z.fail.html.gz#test%2Frubygems This change regenerates the files. A shell script for the regeneration (util/create_certs.sh) is also added.
2019-05-28parse.y: numbered parameter symbolNobuyoshi Nakada
* parse.y (parse_atmark): numbered parameter name is not allowed as a symbol regardless the context.
2019-05-28Use Reline.completer_quote_characters to completeaycabta
2019-05-27Colorize error partNobuyoshi Nakada
2019-05-27Do not make an incomplete escape a valid charNobuyoshi Nakada
2019-05-27Ripper#tokenNobuyoshi Nakada
* parse.y (ripper_token): added Ripper#token which returns the current token string. [EXPERIMENTAL]
2019-05-27open-uri: Regenerate server certificates for testsYusuke Endoh
OpenSSL 1.1.1 requires 2048 bits or more. This change will fix: https://rubyci.org/logs/rubyci.s3.amazonaws.com/debian/ruby-master/log/20190527T003004Z.fail.html.gz#test%2Fopen-uri
2019-05-27context.rb: hide wrapping linesNobuyoshi Nakada
* lib/irb/context.rb (IRB::Context#evaluate): separate the code from wrapping lines to propagate the given exception, not to show the wrapping lines when SyntaxError.
2019-05-26Highlight global variable on IRBTakashi Kokubun
2019-05-26Add FrozenError#receiverJeremy Evans
Similar to NameError#receiver, this returns the object on which the modification was attempted. This is useful as it can pinpoint exactly what is frozen. In many cases when a FrozenError is raised, you cannot determine from the context which object is frozen that you attempted to modify. Users of the current rb_error_frozen C function will have to switch to using rb_error_frozen_object or the new rb_frozen_error_raise in order to set the receiver of the FrozenError. To allow the receiver to be set from Ruby, support an optional second argument to FrozenError#initialize. Implements [Feature #15751]
2019-05-26Refactor IRB color dispatchTakashi Kokubun
The reason why we were checking lexer state in addition to token was that we do not want to colorize local variable, method call, etc., while they share the :on_ident token with a name of method definition which should be colored as blue. It means that we're concerned about the lexer state only for :on_ident. Thus we can skip checking lexer state for non-:on_ident tokens. This refactoring is based on that idea. Also, now we manage Ripper's lexer state as Integer (use `|` if you need to check multiple states). It should be faster than using Array of Integer because #any? block call is not needed.
2019-05-27Support :@@cvar and : on colorizeaycabta
2019-05-26Make the imaginary color on IRB close to pryTakashi Kokubun
and sorted the token names alphabetically.
2019-05-27parse.y: broke the terminator condition downNobuyoshi Nakada
* parse.y (here_document): broke the terminator condition down into each piece, the positional condition, resetting the dedented here-document indentation, and matching identifier. suppress a false warning by icc.
2019-05-26Colorize imaginary and rational literalsNobuyoshi Nakada
2019-05-26parse.y: adjust error indicatorNobuyoshi Nakada
* parse.y (parser_yylex): adjust the error indicator of unexpected fraction part. before: ~~~ 1.2.3 ^~~ ~~~ after: ~~~ 1.2.3 ^~ ~~~
2019-05-26test/ruby/test_notimp.rb: Use EnvUtil.timeout for timeout scale factorNobuyoshi Nakada
2019-05-26test/ruby/test_process.rb: Use EnvUtil.timeout for timeout scale factorYusuke Endoh
https://rubyci.org/logs/rubyci.s3.amazonaws.com/solaris11s-sunc/ruby-master/log/20190526T052508Z.fail.html.gz
2019-05-26test/lib/envutil.rb (EnvUtil.timeout): added.Yusuke Endoh
It is a wrapper for Timeout.timeout with the scale factor applied.
2019-05-26Fix scanner event at invalid syntaxNobuyoshi Nakada
* parse.y (parser_yyerror, parser_compile_error): revert r67224 (e5d10cda07b23682e5e4e64d1324e4d3247d4785) "Flush erred token".
2019-05-26test/rubygems/test_gem_stream_ui.rb (test_ask): extend the timeoutYusuke Endoh
for Solaris. https://rubyci.org/logs/rubyci.s3.amazonaws.com/unstable10s/ruby-master/log/20190525T211908Z.fail.html.gz
2019-05-25Handle keyword symbol in IRB::Color::SymbolStateTakashi Kokubun
2019-05-25Deal with more syntax highlight edge casesTakashi Kokubun
Please refer to the tests again.
2019-05-25Fix more unintended syntax highlightsTakashi Kokubun
See tests for what kind of things are fixed.
2019-05-25Always color Symbol as Yellow on IRB::ColorTakashi Kokubun
Symbol color was made blue as a workaround because it was hard to distinguish `foo`s in `:foo` and `def foo; end` (both are :on_ident). But I wanted to make it yellow like pry. `:Struct` had the same problem in :on_const. Because the :on_const was also blue (but underlined and bold), it was not a big issue. While they're not so problematic since we got a workaround, we also had a more serious issue for highlighting a symbol like `:"a#{b}c"`. The first half was considered as Symbol and the last half was considered as String, because the colorizer did not have a state like a parser. To approach the last issue, I introduced `IRB::Color::SymbolState` which is a thin state manager knowing only "the token is Symbol or not". Having this module magically solves the first two problems as well. So now we can highlight Symbol as yellow in the perfect manner.
2019-05-26test/ruby/test_rubyoptions.rb (test_script_from_stdin): scale timeoutYusuke Endoh
for Solaris. https://rubyci.org/logs/rubyci.s3.amazonaws.com/unstable10s/ruby-master/log/20190525T131909Z.fail.html.gz
2019-05-25Colorize empty embexpr more on IRB::ColorTakashi Kokubun
2019-05-25Support some unhandled syntax highlightTakashi Kokubun
Heredoc, %i, :Foo, { 'a': ... }, ... :'a' is still half-broken.
2019-05-25Clear IRB::Color escape sequence before newlineTakashi Kokubun
because otherwise prompt and other things could be polluted.