summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* error.c: Let Exception#inspect inspect its messageYusuke Endoh2022-06-071-0/+6
| | | | | | | | | | | | ... only when the message string has a newline. `p StandardError.new("foo\nbar")` now prints `#<StandardError: "foo\nbar">' instead of: #<StandardError: bar> [Bug #18170]
* [ruby/rdoc] Allow boolean arguments to `rb_attr` and `rb_define_attr`Nobuyoshi Nakada2022-06-071-70/+19
| | | | | | | | | | Currently only literal `0` and `1` are accepted as `read`/`write` flags. This patch allows other boolean arguments, C macros (`FALSE`/`TRUE`), Ruby `VALUE`s (`Qfalse`/`Qtrue`), and C99 `bool`s (`false`/`true`), as well. https://github.com/ruby/rdoc/commit/169dc02e3c
* Ignore invalid escapes in regexp commentsJeremy Evans2022-06-061-0/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Invalid escapes are handled at multiple levels. The first level is in parse.y, so skip invalid unicode escape checks for regexps in parse.y. Make rb_reg_preprocess and unescape_nonascii accept the regexp options. In unescape_nonascii, if the regexp is an extended regexp, when "#" is encountered, ignore all characters until the end of line or end of regexp. Unfortunately, in extended regexps, you can use "#" as a non-comment character inside a character class, so also parse "[" and "]" specially for extended regexps, and only skip comments if "#" is not inside a character class. Handle nested character classes as well. This issue doesn't just affect extended regexps, it also affects "(#?" comments inside all regexps. So for those comments, scan until trailing ")" and ignore content inside. I'm not sure if there are other corner cases not handled. A better fix would be to redesign the regexp parser so that it unescaped during parsing instead of before parsing, so you already know the current parsing state. Fixes [Bug #18294] Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
* Fix Module#const_source_location for autoload constants with direct requiresJeremy Evans2022-06-061-0/+17
| | | | | | | | | | If an autoload exists for a constant, but the path for the autoload was required, const_source_location would return [false, 0] instead of the actual file and line. This fixes it by setting the appropriate file and line in rb_const_set, and saving the file and line in const_tbl_update before they get reset by current_autoload_data. Fixes [Bug #18624]
* Fix Range#cover? returning true for beginless ranges of different typesJeremy Evans2022-06-061-0/+29
| | | | | | | | | | | | | Previously `(2..).cover?("2"..)` was false, but `(..2).cover?(.."2")` was true. This changes it so both are false, treating beginless ranges the same as endless ranges in regards to type checks. This also adds documentation to #cover? to describe behavior with beginless and endless ranges, testing each documentation example, which is how this bug was found. Fixes [Bug #18155]
* Add Module#undefined_instance_methodsJeremy Evans2022-06-061-0/+9
| | | | | Implements [Feature #12655] Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
* [ruby/rdoc] Use runnable command as DUMMY_PAGERNobuyoshi Nakada2022-06-061-1/+6
| | | | https://github.com/ruby/rdoc/commit/fec1ab2e41
* [ruby/cgi] jruby supportPavel Rosický2022-06-061-0/+1
| | | | https://github.com/ruby/cgi/commit/93326fb622
* Use `sleep 0.5` for tests of GVL instrumentation APIYusuke Endoh2022-06-061-2/+2
| | | | | | | | | | | | | The tests fail randomly on some platforms. http://rubyci.s3.amazonaws.com/ubuntu/ruby-master/log/20220605T213004Z.fail.html.gz http://rubyci.s3.amazonaws.com/arch/ruby-master/log/20220605T210003Z.fail.html.gz ``` [15737/21701] TestThreadInstrumentation#test_thread_instrumentation_fork_safe/home/chkbuild/chkbuild/tmp/build/20220605T213004Z/ruby/tool/lib/test/unit/assertions.rb:109:in `assert': Expected 0 to be nonzero?. (Test::Unit::AssertionFailedError) ``` The failures seem to depend on context switches. I suspect `sleep 0.05` is too short, so this change tries to extend the wait time.
* [ruby/rdoc] Remove `RDoc::RI::Driver#in_path?`Nobuyoshi Nakada2022-06-041-17/+0
| | | | https://github.com/ruby/rdoc/commit/83051403d6
* [ruby/rdoc] Enable pager testsNobuyoshi Nakada2022-06-041-5/+3
| | | | https://github.com/ruby/rdoc/commit/ce63794fde
* [Feature #18339] GVL Instrumentation APIJean Boussier2022-06-031-0/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ref: https://bugs.ruby-lang.org/issues/18339 Design: - This tries to minimize the overhead when no hook is registered. It should only incur an extra unsynchronized boolean check. - The hook list is protected with a read-write lock as to cause contention when some hooks are registered. - The hooks MUST be thread safe, and MUST NOT call into Ruby as they are executed outside the GVL. - It's simply a noop on Windows. API: ``` rb_internal_thread_event_hook_t * rb_internal_thread_add_event_hook(rb_internal_thread_event_callback callback, rb_event_flag_t internal_event, void *user_data); bool rb_internal_thread_remove_event_hook(rb_internal_thread_event_hook_t * hook); ``` You can subscribe to 3 events: - READY: called right before attempting to acquire the GVL - RESUMED: called right after successfully acquiring the GVL - SUSPENDED: called right after releasing the GVL. The hooks MUST be threadsafe, as they are executed outside of the GVL, they also MUST NOT call any Ruby API.
* Move `GC.verify_compaction_references` [Bug #18779]Nobuyoshi Nakada2022-06-021-10/+1
| | | | | Define `GC.verify_compaction_references` as a built-in ruby method, according to GC compaction support via `GC::OPTS`.
* Fix the condition when a new buffer is needed without GMPNobuyoshi Nakada2022-06-021-0/+9
|
* [rubygems/rubygems] Restore ability to load old marshalled gemspec that use ↵David Rodríguez2022-06-011-0/+0
| | | | | | | | | | | | | | | `YAML::PrivateType` This issue was not detected because when all traces of old YAML parser and emitter `Syck` were removed, this null-type.gemspec.rz marshalled gemspec was updated to no longer load `YAML::Syck::PrivateType` but load `Psych::PrivateType` instead. However, realworld old marshalled gemspecs still use the `YAML::PrivateType` constant, so this commit replaces the gemspec to be the real pry-0.4.7 marshalled gemspec, so that it catches this issue. https://github.com/rubygems/rubygems/commit/51b330b8d2
* [rubygems/rubygems] Improve null private type testDavid Rodríguez2022-06-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | This test is making sure that RubyGems is able to load old marshalled gemspecs that include a field loading `YAML::PrivateType` instances in the `rubyforge_project` field instead of `nil` due to a bug in old YAML emitters. At some point, the `rubyforge_project` field was removed and this test was updated to just check another field. However, in the realworld other fields do not have this issue and the marshalled gemspec we use for testing still has this issue in the field reserved for the `rubyforge_project` field. So I think updating the test to check other field was not correct. Instead, since the `rubyforge_project` field is now ignored, we no longer need to worry about any conversion in this field. The only thing we care about is that the marshal loading still works (which requires that the constant is at least defined). So this commit updates the test to make this more clear. https://github.com/rubygems/rubygems/commit/cddfacf6d4
* Skip failing test with freebsdHiroshi SHIBATA2022-05-311-0/+2
|
* [rubygems/rubygems] Bump rb-sys in ↵dependabot[bot]2022-05-312-46/+65
| | | | | | | | | | | | | | | | | | /test/rubygems/test_gem_ext_cargo_builder/custom_name Bumps [rb-sys](https://github.com/ianks/rb-sys) from v0.7.3 to v0.9.0. - [Release notes](https://github.com/ianks/rb-sys/releases) - [Commits](https://github.com/ianks/rb-sys/compare/4a5dd9782075fc6e197976eb2188231a388c3c95...https://github.com/rubygems/rubygems/commit/e4f00b9761af) --- updated-dependencies: - dependency-name: rb-sys dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> https://github.com/rubygems/rubygems/commit/874bbc96b2
* [rubygems/rubygems] Bump rb-sysdependabot[bot]2022-05-312-46/+65
| | | | | | | | | | | | | | | | Bumps [rb-sys](https://github.com/ianks/rb-sys) from v0.7.3 to v0.9.0. - [Release notes](https://github.com/ianks/rb-sys/releases) - [Commits](https://github.com/ianks/rb-sys/compare/4a5dd9782075fc6e197976eb2188231a388c3c95...https://github.com/rubygems/rubygems/commit/e4f00b9761af) --- updated-dependencies: - dependency-name: rb-sys dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> https://github.com/rubygems/rubygems/commit/eb31b14a37
* Fix use-after-free with interacting TracePointsAlan Wu2022-05-302-0/+31
| | | | | | | | | | | | | | `vm_trace_hook()` runs global hooks before running local hooks. Previously, we read the local hook list before running the global hooks which led to use-after-free when a global hook frees the local hook list. A global hook can do this by disabling a local TracePoint, for example. Delay local hook list loading until after running the global hooks. Issue discovered by Jeremy Evans in GH-5862. [Bug #18730]
* Skip failing test with freebsdHiroshi SHIBATA2022-05-301-0/+2
|
* [ruby/stringio] Accept external and internal encodings pairNobuyoshi Nakada2022-05-301-0/+6
| | | | | | Fix https://github.com/ruby/stringio/pull/16 https://github.com/ruby/stringio/commit/c8a69e80d2
* Also skip failing test with freebsd 12Hiroshi SHIBATA2022-05-301-0/+2
|
* [ruby/stringio] Fix handling of chomp with paragraph separatorJeremy Evans2022-05-301-12/+12
| | | | | | | | | | Try to mirror IO behavior, where chomp takes out the entire paragraph separators between entries, but does not chomp a single line separator at the end of the string. Partially Fixes [Bug #18768] https://github.com/ruby/stringio/commit/a83ddbb7f0
* [ruby/stringio] Ignore chomp keyword for nil separatorJeremy Evans2022-05-301-2/+5
| | | | | | | | | nil separator means no separator at all, so nothing should be chomped. Partial fix for Ruby [Bug #18770] https://github.com/ruby/stringio/commit/feaa2ec631
* [ruby/stringio] Fix each with multiple character string and chompJeremy Evans2022-05-301-0/+7
| | | | | | | | | | Previously, this could result in an infinite loop. Always update the e pointer in this case, setting w when chomping so the chomped data is not included in the output. Fixes [Bug #18769] https://github.com/ruby/stringio/commit/4bf64d5130
* [ruby/stringio] Fix expanding size at ungetc/ungetbyteNobuyoshi Nakada2022-05-301-4/+21
| | | | https://github.com/ruby/stringio/commit/a35268a3ac
* Skip failing test with freebsdHiroshi SHIBATA2022-05-301-0/+5
|
* [rubygems/rubygems] Fix rubygems update when non default `--install-dir` is ↵David Rodríguez2022-05-281-0/+31
| | | | | | configured https://github.com/rubygems/rubygems/commit/9f3b21192d
* Fix GC race condition in autoload.Samuel Williams2022-05-261-0/+1
|
* Retain reference to blocking fibers.Samuel Williams2022-05-252-18/+22
|
* Define unsupported GC compaction methods as rb_f_notimplementMike Dalessio2022-05-241-15/+43
| | | | | | | | | | | | | | | | | | | | | | | Fixes [Bug #18779] Define the following methods as `rb_f_notimplement` on unsupported platforms: - GC.compact - GC.auto_compact - GC.auto_compact= - GC.latest_compact_info - GC.verify_compaction_references This change allows users to call `GC.respond_to?(:compact)` to properly test for compaction support. Previously, it was necessary to invoke `GC.compact` or `GC.verify_compaction_references` and check if those methods raised `NotImplementedError` to determine if compaction was supported. This follows the precedent set for other platform-specific methods. For example, in `process.c` for methods such as `Process.fork`, `Process.setpgid`, and `Process.getpriority`.
* [rubygems/rubygems] Support the change of did_you_mean about ↵Yusuke Endoh2022-05-231-1/+7
| | | | | | | | | | | | | | | | | | Exception#detailed_message I am asking did_you_mean to use Exception#detailed_message to add "Did you mean?" suggestion instead of overriding #message method. https://github.com/ruby/did_you_mean/pull/177 Unfortunately, the change will affect Gem::UnknownCommandError, which excepts did_you_mean to override #message method. This PR absorbs the change of did_you_mean. Gem::CommandManager now calls #detailed_message method to get a message string with "Did you mean?" suggestion from an exception. https://github.com/rubygems/rubygems/commit/8f104228d3
* Prevent a warning: `*' interpreted as argument prefixYusuke Endoh2022-05-231-2/+2
|
* Make the test class naming consistentTakashi Kokubun2022-05-201-1/+1
| | | | forgot to commit this in ead96e7b44b98bef4896d836239345012821f1d2
* Rename test_jit to test_mjitTakashi Kokubun2022-05-205-15/+15
| | | | to avoid confusion with YJIT
* Rewrite with assert_ractor for multiple ractor environmentHiroshi SHIBATA2022-05-201-71/+86
|
* Picked the missing test file from ↵Hiroshi SHIBATA2022-05-201-0/+102
| | | | https://github.com/ruby/did_you_mean/commit/8faba54b2d3ec9aa570691775f143801308c5b2f
* [ruby/racc] Show diffsNobuyoshi Nakada2022-05-201-2/+1
| | | | https://github.com/ruby/racc/commit/0b679e2f69
* [flori/json] Fix parser bug for empty string allocationAndrew Bromwich2022-05-201-0/+1
| | | | | | | | | | When `HAVE_RB_ENC_INTERNED_STR` is enabled it is possible to pass through a null pointer to `rb_enc_interned_str` resulting in a segfault Fixes #495 https://github.com/flori/json/commit/b59368a8c2
* [flori/json] Remove unknown keyword arg from DateTime.parseCharles Oliver Nutter2022-05-201-1/+1
| | | | | | | | | This snuck in while addding tests for the `create_additions` feature. Caught by JRuby when we added the `limit` option to the Date/DateTime parsing methods, which causes this to be rejected as an unknown keyword. https://github.com/flori/json/commit/b1007dff66
* Merge RubyGems and Bundler HEADHiroshi SHIBATA2022-05-2016-58/+58
| | | | https://github.com/rubygems/rubygems/commit/125415593ead9ab69a9f0bb5392c9d7ec61b1f51
* YJIT: Add opt_succ (#5919)Takashi Kokubun2022-05-191-0/+4
|
* [ruby/timeout] Handle Timeout + fork and add test for itBenoit Daloze2022-05-191-0/+20
| | | | https://github.com/ruby/timeout/commit/4baee63b9b
* [ruby/timeout] Reimplement Timeout.timeout with a single thread and a QueueBenoit Daloze2022-05-191-0/+13
| | | | https://github.com/ruby/timeout/commit/2bafc458f1
* Restore implicit relationship between `autoload_const` and `autoload_data` ↵Samuel Williams2022-05-171-0/+20
| | | | during GC. (#5911)
* Delete autoload data from global features after autoload has completed. (#5910)Samuel Williams2022-05-171-0/+28
| | | | | * Update naming of critical section assertions macros. * Improved locking for autoload.
* YJIT: Implement getblockparamAaron Patterson2022-05-121-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | This implements the getblockparam instruction. There are two cases we need to handle depending on whether or not VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM is set in the environment flag. When the modified flag is unset, we need to call rb_vm_bh_to_procval to get a proc from our passed block, save the proc in the environment, and set the modified flag. In the case that the modified flag is set we are able to just use the existing proc in the environment. One quirk of this is that we need to call jit_prepare_routine_call early and ensure we update PC and SP regardless of the branch taken, so that we have a consistent SP offset at the start of the next instruction. We considered using a chain guard to generate these two paths separately, but decided against it because it's very common to see both and the modified case is basically a subset of the instructions in the unmodified case. This includes tests for both getblockparam and getblockparamproxy which was previously missing a test.
* [ruby/uri] Improve URI.register_scheme tests and automatically upcase the ↵Benoit Daloze2022-05-121-3/+37
| | | | | | | | | | given scheme * Also add docs and mention current limitations. * For reference, https://stackoverflow.com/a/3641782/388803 mentions the valid characters in schemes. https://github.com/ruby/uri/commit/4346daac75
* [ruby/uri] Add URI::Generic#decoded_#{user,password}Jeremy Evans2022-05-122-0/+61
| | | | | | | | | | | | | | | | | | | | | | URI::Generic#{user,password} return the encoded values, which are not that useful if you want to do authentication with them. Automatic decoding by default would break backwards compatibility. Optional automatic decoding via a keyword to URI.parse would require threading the option through at least 3 other methods, and would make semantics confusing (user= takes encoded or unencoded password?) or require more work. Thus, adding this as a separate method seemed the simplest approach. Unfortunately, URI lacks a method for correct decoding. Unlike in www form components, + in earlier parts of the URI such as the userinfo section is treated verbatim and not as an encoded space. Add URI.#{en,de}code_uri_component methods, which are almost the same as URI.#{en,de}code_www_form_component, but without the special SP => + handling. Implements [Feature #9045] https://github.com/ruby/uri/commit/16cfc4e92f