summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* Avoid defining the same test class in multiple filesJeremy Evans2022-04-2247-1356/+1280
| | | | | | | | | Should fix issues with parallel testing sometimes not running all tests. This should be viewed skipping whitespace changes. Fixes [Bug #18731]
* Uncomment code to raise LocalJumpError for yield across thread through enumJeremy Evans2022-04-211-0/+55
| | | | | | | | Not sure if this is the correct fix. It does raise LocalJumpError in the yielding thread as you would expect, but the value yielded to the calling thread is still yielded without an exception. Fixes [Bug #18649]
* Use https for wss testHiroshi SHIBATA2022-04-221-1/+1
|
* [ruby/uri] Feat: Support WSSOKURA Masafumi2022-04-222-3/+74
| | | | | | | | There was a file for WSS so I added one line of `require_relative` to make it work. Now `URI.parse('wss://example.com')` returns `URI::WS`. https://github.com/ruby/uri/commit/ff8a103564
* [ruby/pathname] Implement Pathname#lutimeAkinori MUSHA2022-04-211-0/+19
| | | | https://github.com/ruby/pathname/commit/268cb5acff
* Private local variables should shadow outer variables [Bug #18629]Nobuyoshi Nakada2022-04-211-0/+4
|
* [ruby/net-http] Feature detect to make net/http usable with JRubyKarol Bucek2022-04-201-3/+5
| | | | | | | | Handle missing session_new_cb= and do not call session_cache_mode=, as JRuby SSL does not support these methods. https://github.com/ruby/net-http/commit/3237ef4d8c
* [ruby/net-http] Add ignore_eof access to HTTP and HTTPResponseJeremy Evans2022-04-201-0/+30
| | | | | | | | | | | | | | | | | | | The ignore_eof setting on HTTPResponse makes it so an EOFError is raised when reading bodies with a defined Content-Length, if the body read was truncated due to the socket be closed. The ignore_eof setting on HTTP sets the values used in responses that are created by the object. For backwards compatibility, the default is for both settings is true. However, unless you are specifically tested for and handling truncated responses, it's a good idea to set ignore_eof to false so that errors are raised for truncated responses, instead of those errors silently being ignored. Fixes [Bug #14972] https://github.com/ruby/net-http/commit/4d47e34995
* Github -> GitHubTim Smith2022-04-191-1/+1
| | | | | | Fix the case of GitHub in various places Signed-off-by: Tim Smith <tsmith@mondoo.com>
* Fix class ancestry checks for duped classesJohn Hawthorn2022-04-161-0/+20
| | | | | | | | | | | | | | | Previously in some when classes were duped (specifically those with a prepended module), they would not correctly have their "superclasses" array or depth filled in. This could cause ancestry checks (like is_a? and Module comparisons) to return incorrect results. This happened because rb_mod_init_copy builds origin classes in an order that doesn't have the super linked list fully connected until it's finished. This commit fixes the previous issue by calling rb_class_update_superclasses before returning the cloned class. This is similar to what's already done in make_metaclass.
* [rubygems/rubygems] Fix test issues surfaced using a stricter behavior of ↵David Rodríguez2022-04-161-5/+3
| | | | | | | | | | | | | | | | | | | | `FileUtils` We were trying to remove directories using `FileUtils.rm_f` which is unexpected and does not remove anything. Changing to `FileUtils.rm_rf` actually removes the directories properly. That itself showed other issues: * One test was actually removing the gem package it was about to install, since it was living in the cache folder. To fix that, avoid removing the cache folder, and only make sure the other directories are created automatically, which seems enough. * Another test was actually removing an incorrect directory. Change it to remove the right one (the one that's asserted later to have been created). https://github.com/rubygems/rubygems/commit/5538e7ff20
* Compare predicate methods as a boolean valueNobuyoshi Nakada2022-04-151-19/+23
|
* [Win32] Fix mode of character/pipe device stat [Bug #18732]Nobuyoshi Nakada2022-04-151-5/+28
|
* [ruby/rdoc] Apply matching word pairs to underscore-methodsNobuyoshi Nakada2022-04-141-0/+2
| | | | | | | Protected characters with `PROTECT_ATTR` should not have special roles. https://github.com/ruby/rdoc/commit/c318af0ea2
* [ruby/rdoc] Allow cross references to methods including underscoresNobuyoshi Nakada2022-04-141-6/+8
| | | | | | | As underscores are masked to "protect" from the conversion, consider also `PROTECT_ATTR` as a word character. https://github.com/ruby/rdoc/commit/db58bb5170
* [ruby/net-http] Update the content-length heading when decoding bodiesJeremy Evans2022-04-141-0/+13
| | | | | | | | | | | | | | | | | Previously, the content-encoding header was removed and the body was modified, but the content-length header was not modified, resulting in the content-length header not matching the body length. Don't delete content-length before yielding inflate body, as that causes a switch to read the entire body instead of reading in chunks. Fixes [Bug #16672] https://github.com/ruby/net-http/commit/58284e9710 Co-authored-by: st0012 <stan001212@gmail.com>
* [ruby/rdoc] Only parse valid URLsPeter Zhu2022-04-131-0/+1
| | | | | | | | | Only valid characters for URLs should be used for generating URLs. A list of valid characters can be found in sections 2.2 and 2.3 of IETF RFC 3986 (https://www.ietf.org/rfc/rfc3986.txt). https://github.com/ruby/rdoc/commit/2bd8fcdd4f
* Use an empty string when building File.expand_pathPeter Zhu2022-04-121-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allocating a string of length MAXPATHLEN and then shrinking the string is inefficient when the resulting path is short. Preallocating a large string is also a problem for Variable Width Allocation since we can't easily downsize the capacity. I ran the following benchmark: ```ruby Benchmark.ips do |x| { "empty" => "", "short" => "a/" * 10, "medium" => "a/" * 100, "long" => "a/" * 500 }.each do |name, path| x.report(name) do |times| i = 0 while i < times File.expand_path(path) i += 1 end end end end ``` On this commit: ``` empty 97.486k (± 0.7%) i/s - 492.915k in 5.056507s short 96.026k (± 2.4%) i/s - 486.489k in 5.068966s medium 86.304k (± 1.3%) i/s - 435.336k in 5.045112s long 59.395k (± 1.7%) i/s - 302.175k in 5.089026s ``` On master: ``` empty 94.138k (± 1.4%) i/s - 472.158k in 5.016590s short 92.043k (± 1.4%) i/s - 468.180k in 5.087496s medium 84.910k (± 2.3%) i/s - 425.750k in 5.017007s long 61.503k (± 2.7%) i/s - 309.723k in 5.039429s ```
* Fix dtoa buffer overrunNobuyoshi Nakada2022-04-121-0/+18
| | | | https://hackerone.com/reports/1248108
* Just free compiled pattern if no space is usedNobuyoshi Nakada2022-04-121-0/+9
| | | | https://hackerone.com/reports/1220911
* [ruby/net-http] Add HTTP#response_body_encoding for setting response body ↵Jeremy Evans2022-04-122-0/+289
| | | | | | | | | | | | | | | | | | | encoding This allows for the ability to opt-in to a method to set the encoding of response bodies. By setting the accessor to a String or Encoding instance, it will use the specified encoding. Setting the value of true will try to detect the encoding of the response body, either using the Content-Type header (assuming it specifies charset) or by scanning for a <meta> tag in the document that specifies the encoding. The default is false in which case no forcing of encoding will be done (same as before the patch). Implements [Feature #2567] Implements [Feature #15517] https://github.com/ruby/net-http/commit/6233e6b7c1 Co-authored-by: Yui Naruse <naruse@ruby-lang.org>
* test/ruby/test_keyword.rb: Prevent warning: assigned but unused variableYusuke Endoh2022-04-111-1/+0
|
* Raise RuntimeError if Kernel#binding is called from a non-Ruby frameJeremy Evans2022-04-062-27/+38
| | | | | | | | | Check whether the current or previous frame is a Ruby frame in call_trace_func and rb_tracearg_binding before attempting to create a binding for the frame. Fixes [Bug #18487] Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
* [rubygems/rubygems] Set `@tempdir` as early as possibleDavid Rodríguez2022-04-071-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have seen some errors during test `setup` before `@tempdir` is actually set, in particular, when instantiating `Gem::MockUI` which in turn requires `stringio`. In this case, the `teardown` method will also produce an error because it tries to remove the `@tempdir`, which has not been set, so tries to remove a `nil` directory. It results in a confusing error like ``` <internal:D:/a/rubygems/rubygems/lib/rubygems/core_ext/kernel_require.rb>:85:in `require': Interrupt Error: test_bump_one_level(TestGemVersion): TypeError: no implicit conversion of nil into String C:/hostedtoolcache/windows/Ruby/3.1.1/x64/lib/ruby/3.1.0/fileutils.rb:1570:in `path' from <internal:D:/a/rubygems/rubygems/lib/rubygems/core_ext/kernel_require.rb>:85:in `require' C:/hostedtoolcache/windows/Ruby/3.1.1/x64/lib/ruby/3.1.0/fileutils.rb:1570:in `block in fu_list' from D:/a/rubygems/rubygems/lib/rubygems/mock_gem_ui.rb:43:in `initialize' C:/hostedtoolcache/windows/Ruby/3.1.1/x64/lib/ruby/3.1.0/fileutils.rb:1570:in `map' from D:/a/rubygems/rubygems/test/rubygems/helper.rb:323:in `new' C:/hostedtoolcache/windows/Ruby/3.1.1/x64/lib/ruby/3.1.0/fileutils.rb:1570:in `fu_list' from D:/a/rubygems/rubygems/test/rubygems/helper.rb:323:in `setup' C:/hostedtoolcache/windows/Ruby/3.1.1/x64/lib/ruby/3.1.0/fileutils.rb:616:in `rm_r' from C:/hostedtoolcache/windows/Ruby/3.1.1/x64/lib/ruby/gems/3.1.0/gems/test-unit-3.5.3/lib/test/unit/fixture.rb:284:in `run_fixture_callback' C:/hostedtoolcache/windows/Ruby/3.1.1/x64/lib/ruby/3.1.0/fileutils.rb:638:in `rm_rf' from C:/hostedtoolcache/windows/Ruby/3.1.1/x64/lib/ruby/gems/3.1.0/gems/test-unit-3.5.3/lib/test/unit/fixture.rb:272:in `block in create_fixtures_runner' D:/a/rubygems/rubygems/test/rubygems/helper.rb:462:in `teardown' from C:/hostedtoolcache/windows/Ruby/3.1.1/x64/lib/ruby/gems/3.1.0/gems/test-unit-3.5.3/lib/test/unit/fixture.rb:276:in `block in create_fixtures_runner' =============================================================================== from C:/hostedtoolcache/windows/Ruby/3.1.1/x64/lib/ruby/gems/3.1.0/gems/test-unit-3.5.3/lib/test/unit/fixture.rb:257:in `run_fixture' from C:/hostedtoolcache/windows/Ruby/3.1.1/x64/lib/ruby/gems/3.1.0/gems/test-unit-3.5.3/lib/test/unit/fixture.rb:292:in `run_setup' Finished in 683.0312862 seconds. from C:/hostedtoolcache/windows/Ruby/3.1.1/x64/lib/ruby/gems/3.1.0/gems/test-unit-3.5.3/lib/test/unit/testcase.rb:564:in `block in run' ------------------------------------------------------------------------------- from C:/hostedtoolcache/windows/Ruby/3.1.1/x64/lib/ruby/gems/3.1.0/gems/test-unit-3.5.3/lib/test/unit/testcase.rb:563:in `catch' 2185 tests, 5929 assertions, 0 failures, 1 errors, 28 pendings, 0 omissions, 0 notifications from C:/hostedtoolcache/windows/Ruby/3.1.1/x64/lib/ruby/gems/3.1.0/gems/test-unit-3.5.3/lib/test/unit/testcase.rb:563:in `run' 98.7185% passed from C:/hostedtoolcache/windows/Ruby/3.1.1/x64/lib/ruby/gems/3.1.0/gems/test-unit-3.5.3/lib/test/unit/testsuite.rb:124:in `run_test' ------------------------------------------------------------------------------- from C:/hostedtoolcache/windows/Ruby/3.1.1/x64/lib/ruby/gems/3.1.0/gems/test-unit-3.5.3/lib/test/unit/testsuite.rb:53:in `run' 3.20 tests/s, 8.68 assertions/sTerminate batch job (Y/N)? from C:/hostedtoolcache/windows/Ruby/3.1.1/x64/lib/ruby/gems/3.1.0/gems/test-unit-3.5.3/lib/test/unit/testsuite.rb:124:in `run_test' from C:/hostedtoolcache/windows/Ruby/3.1.1/x64/lib/ruby/gems/3.1.0/gems/test-unit-3.5.3/lib/test/unit/testsuite.rb:53:in `run' from C:/hostedtoolcache/windows/Ruby/3.1.1/x64/lib/ruby/gems/3.1.0/gems/test-unit-3.5.3/lib/test/unit/testsuite.rb:124:in `run_test' from C:/hostedtoolcache/windows/Ruby/3.1.1/x64/lib/ruby/gems/3.1.0/gems/test-unit-3.5.3/lib/test/unit/testsuite.rb:53:in `run' from C:/hostedtoolcache/windows/Ruby/3.1.1/x64/lib/ruby/gems/3.1.0/gems/test-unit-3.5.3/lib/test/unit/ui/testrunnermediator.rb:67:in `run_suite' from C:/hostedtoolcache/windows/Ruby/3.1.1/x64/lib/ruby/gems/3.1.0/gems/test-unit-3.5.3/lib/test/unit/ui/testrunnermediator.rb:45:in `block (2 levels) in run' from C:/hostedtoolcache/windows/Ruby/3.1.1/x64/lib/ruby/gems/3.1.0/gems/test-unit-3.5.3/lib/test/unit/ui/testrunnermediator.rb:102:in `with_listener' from C:/hostedtoolcache/windows/Ruby/3.1.1/x64/lib/ruby/gems/3.1.0/gems/test-unit-3.5.3/lib/test/unit/ui/testrunnermediator.rb:41:in `block in run' from C:/hostedtoolcache/windows/Ruby/3.1.1/x64/lib/ruby/gems/3.1.0/gems/test-unit-3.5.3/lib/test/unit/ui/testrunnermediator.rb:39:in `catch' from C:/hostedtoolcache/windows/Ruby/3.1.1/x64/lib/ruby/gems/3.1.0/gems/test-unit-3.5.3/lib/test/unit/ui/testrunnermediator.rb:39:in `run' from C:/hostedtoolcache/windows/Ruby/3.1.1/x64/lib/ruby/gems/3.1.0/gems/test-unit-3.5.3/lib/test/unit/ui/testrunner.rb:40:in `start_mediator' from C:/hostedtoolcache/windows/Ruby/3.1.1/x64/lib/ruby/gems/3.1.0/gems/test-unit-3.5.3/lib/test/unit/ui/testrunner.rb:25:in `start' from C:/hostedtoolcache/windows/Ruby/3.1.1/x64/lib/ruby/gems/3.1.0/gems/test-unit-3.5.3/lib/test/unit/ui/testrunnerutilities.rb:24:in `run' from C:/hostedtoolcache/windows/Ruby/3.1.1/x64/lib/ruby/gems/3.1.0/gems/test-unit-3.5.3/lib/test/unit/autorunner.rb:458:in `block in run' from C:/hostedtoolcache/windows/Ruby/3.1.1/x64/lib/ruby/gems/3.1.0/gems/test-unit-3.5.3/lib/test/unit/autorunner.rb:514:in `change_work_directory' from C:/hostedtoolcache/windows/Ruby/3.1.1/x64/lib/ruby/gems/3.1.0/gems/test-unit-3.5.3/lib/test/unit/autorunner.rb:457:in `run' from C:/hostedtoolcache/windows/Ruby/3.1.1/x64/lib/ruby/gems/3.1.0/gems/test-unit-3.5.3/lib/test/unit/autorunner.rb:66:in `run' from C:/hostedtoolcache/windows/Ruby/3.1.1/x64/lib/ruby/gems/3.1.0/gems/test-unit-3.5.3/lib/test/unit.rb:518:in `block (2 levels) in <top (required)>' rake aborted! Interrupt: ``` The should make this same error much cleaner if it happens again. https://github.com/rubygems/rubygems/commit/fa649d22e8
* [rubygems/rubygems] Use `ask_yes_no`Ashley Ellis Pierce2022-04-061-30/+30
| | | | https://github.com/rubygems/rubygems/commit/1d38e167fa
* [rubygems/rubygems] Use YAMLAshley Ellis Pierce2022-04-063-6/+6
| | | | https://github.com/rubygems/rubygems/commit/6122e8cac5
* [rubygems/rubygems] Accomodate gem hosts without profile/me endpointAshley Ellis Pierce2022-04-062-1/+33
| | | | https://github.com/rubygems/rubygems/commit/31b6dcf5d3
* [rubygems/rubygems] Update endpointAshley Ellis Pierce2022-04-062-2/+2
| | | | https://github.com/rubygems/rubygems/commit/a5a7b3ec96
* [rubygems/rubygems] Fix lintAshley Ellis Pierce2022-04-062-4/+4
| | | | https://github.com/rubygems/rubygems/commit/a68bfde18e
* [rubygems/rubygems] Make mfa the defaultAshley Ellis Pierce2022-04-061-2/+2
| | | | https://github.com/rubygems/rubygems/commit/0b636f6902
* [rubygems/rubygems] Correct mfa level nameAshley Ellis Pierce2022-04-061-24/+28
| | | | https://github.com/rubygems/rubygems/commit/a002e351ae
* [rubygems/rubygems] Enable mfa on specific keys during gem signinAshley Ellis Pierce2022-04-063-4/+64
| | | | https://github.com/rubygems/rubygems/commit/e787f7f655
* Fix using anonymous block in method accepting explicit keywordsJeremy Evans2022-04-051-0/+54
| | | | | | | Record block ID before vtable_pop, so the incorrect one doesn't override it. Fixes [Bug #18673]
* Unflag a splatted flagged hash if the method doesn't use ruby2_keywordsJeremy Evans2022-04-051-0/+48
| | | | | | | | | | | | | | | | | | | | | | | | For a method such as: def foo(*callee_args) end If this method is called with a flagged hash (created by a method flagged with ruby2_keywords), this previously passed the hash through without modification. With this change, it acts as if the last hash was passed as keywords, so a call to: foo(*caller_args) where the last element of caller_args is a flagged hash, will be treated as: foo(*caller_args[0...-1], **caller_args[-1]) As a result, inside foo, callee_args[-1] is an unflagged duplicate of caller_args[-1] (all other elements of callee_args match caller_args). Fixes [Bug #18625]
* Apply timescale configuration for tests of Regexp.timeoutYusuke Endoh2022-04-051-6/+11
|
* [ruby/net-http] Revert "Update the content-length heading when decoding bodies"Jeremy Evans2022-04-031-13/+0
| | | | | | | | | This reverts commit https://github.com/ruby/net-http/commit/a7cb30124cf1. This is causing errors in Ruby's CI, will revert for now and try again after testing a fix with Ruby's CI. https://github.com/ruby/net-http/commit/7b852b1feb
* [ruby/zlib] Mask checksums to lower 32bitsNobuyoshi Nakada2022-04-021-0/+2
| | | | | | Upper bits affect the result of `crc32` in zlib 1.2.12. https://github.com/ruby/zlib/commit/9ab6d04af1
* Finer-grained constant cache invalidation (take 2)Kevin Newton2022-04-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | This commit reintroduces finer-grained constant cache invalidation. After 8008fb7 got merged, it was causing issues on token-threaded builds (such as on Windows). The issue was that when you're iterating through instruction sequences and using the translator functions to get back the instruction structs, you're either using `rb_vm_insn_null_translator` or `rb_vm_insn_addr2insn2` depending if it's a direct-threading build. `rb_vm_insn_addr2insn2` does some normalization to always return to you the non-trace version of whatever instruction you're looking at. `rb_vm_insn_null_translator` does not do that normalization. This means that when you're looping through the instructions if you're trying to do an opcode comparison, it can change depending on the type of threading that you're using. This can be very confusing. So, this commit creates a new translator function `rb_vm_insn_normalizing_translator` to always return the non-trace version so that opcode comparisons don't have to worry about different configurations. [Feature #18589]
* [ruby/net-http] Update the content-length heading when decoding bodiesJeremy Evans2022-04-021-0/+13
| | | | | | | | | | | Previously, the content-encoding header was removed and the body was modified, but the content-length header was not modified, resulting in the content-length header not matching the body length. Fixes [Bug #16672] https://github.com/ruby/net-http/commit/a7cb30124c
* Revert "Raise RuntimeError if Kernel#binding is called from a non-Ruby frame"Jeremy Evans2022-04-012-32/+27
| | | | | | This reverts commit 343ea9967e4a6b279eed6bd8e81ad0bdc747f254. This causes an assertion failure with -DRUBY_DEBUG=1 -DRGENGC_CHECK_MODE=2
* Return only captured range in `MatchData` [Bug #18670]Nobuyoshi Nakada2022-03-311-0/+1
|
* test/date/test_date_parse.rb: relax the time limitYusuke Endoh2022-03-311-2/+2
| | | | | | | | | | | | | The timeout was very strict for weak CI machines like qemu-riscv. Due to the additional overhead for Regexp.timeout=, it started failing on such machines. http://rubyci.s3.amazonaws.com/debian-riscv64/ruby-master/log/20220330T200018Z.fail.html.gz ``` 1) Error: TestDateParse#test__parse_too_long_year: Timeout::Error: execution expired ```
* re.c: stop a wrong warning of "flags ignored" on Regexp.new(//)Yusuke Endoh2022-03-311-0/+2
| | | | [Bug #18669]
* Do not autosplat array in block call just because keywords acceptedJeremy Evans2022-03-302-1/+83
| | | | | | | | | | | If the block only accepts a single positional argument plus keywords, then do not autosplat. Still autosplat if the block accepts more than one positional argument in addition to keywords. Autosplatting a single positional argument plus keywords made sense in Ruby 2, since a final positional hash could be used as keywords, but it does not make sense in Ruby 3. Fixes [Bug #18633]
* re.c: raise Regexp::TimeoutError instead of RuntimeErrorYusuke Endoh2022-03-301-2/+2
|
* re.c: Add `timeout` keyword for Regexp.new and Regexp#timeoutYusuke Endoh2022-03-301-0/+17
|
* re.c: Add Regexp.timeout= and Regexp.timeoutYusuke Endoh2022-03-301-0/+17
| | | | [Feature #17837]
* Avoid trace events in implementation of TracePoint#enableJeremy Evans2022-03-291-1/+1
| | | | | | | | | This is more backwards compatible, and should fix issues with power_assert. Unfortunately, it requires using a sentinel value as the default value of target_thread, instead of the more natural expression used in the original approach.
* Make TracePoint#enable with block target current thread by defaultJeremy Evans2022-03-291-16/+21
| | | | | | | | | | | | If TracePoint#enable is passed a block, it previously started the trace on all threads. This changes it to trace only the current thread by default. To limit the scope of the change, the current thread is only used by default if target and target_line are both nil. You can pass target_thread: nil to enable tracing on all threads, to get the previous default behavior. Fixes [Bug #16889]
* Fix multiplex backreferencs near end of string in regexp matchJeremy Evans2022-03-291-0/+6
| | | | | | Idea from Jirka Marsik. Fixes [Bug #18631]