summaryrefslogtreecommitdiff
path: root/test/ruby
AgeCommit message (Collapse)Author
2021-07-08Adapt test_emoji_breaks.rb to Unicode 13.0.0/Emoji 13.0Martin Dürst
- Add UNICODE_VERSION,... to deal with new location of some of the emoji-related data files. - Introduce class BreakFile to handle various file properties. - Adapt main code to use BreakFile.
2021-07-04Add domain check macrosNobuyoshi Nakada
2021-07-04Removed extra double quotes from domain error messagesNobuyoshi Nakada
2021-07-01Keep GC disabled until VM bootstrap has done [Bug #17583]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4617
2021-07-01- add regression tests for U+6E7F (湿) in ISO-2022-JPMartin Dürst
In ISO-2022-JP, the bytes use to code are the same as those for "<>". This adds regression tests to make sure that these bytes, when representing 湿, are NOT escaped with encode("ISO-2022-JP, xml: :text) or similar. These are additional regression tests for #12052.
2021-07-01Replace copy coroutine with pthread implementation.Samuel Williams
2021-06-30Prevent "warning: ambiguity between regexp and two divisions"Yusuke Endoh
2021-06-30Use Module#ancestors order in recursive constant lookupAlan Wu
Before this commit, const_get with inherit=true and constant lookup expressions searched the ancestors of the starting point in an order different from `starting_point.ancestors`. Items in the ancestry list introduced through prepend were searched after searching the module they were prepended into. This oddity allowed for situations where constant lookups gave different results even though `starting_point.ancestors` is the same. Do the lookup in the same order as `starting_point.ancestors` by skipping classes and modules that have an origin iclass. The origin iclass is in the super chain after the prepended modules. Note that just like before this commit, the starting point of the constant lookup is always the first item that we search, regardless of the presence of any prepended modules. [Bug #17887] Notes: Merged: https://github.com/ruby/ruby/pull/4585
2021-06-29[WIP] add error_squiggle gemYusuke Endoh
``` $ ./local/bin/ruby -e '1.time {}' -e:1:in `<main>': undefined method `time' for 1:Integer (NoMethodError) 1.time {} ^^^^^ Did you mean? times ``` https://bugs.ruby-lang.org/issues/17930 Notes: Merged: https://github.com/ruby/ruby/pull/4586
2021-06-29Prefer qualified names under ThreadNobuyoshi Nakada
2021-06-27Check if closed after each yield [Bug #17661]Nobuyoshi Nakada
2021-06-26Work around issue transcoding issue with non-ASCII compatible encodings and ↵Jeremy Evans
xml escaping When using a non-ASCII compatible source and destination encoding and xml escaping (the :xml option to String#encode), the resulting string was broken, as it used the correct non-ASCII compatible encoding, but contained data that was ASCII-compatible instead of compatible with the string's encoding. Work around this issue by detecting the case where both the source and destination encoding are non-ASCII compatible, and transcoding the source string from the non-ASCII compatible encoding to UTF-8. The xml escaping code will correctly handle the UTF-8 source string and the return the correctly encoded and escaped value. Fixes [Bug #12052] Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/4605 Merged-By: jeremyevans <code@jeremyevans.net>
2021-06-24Remove shift of ep when computing Proc#hashJeremy Evans
The shift was causing far fewer unique values of hash than expected. Fix pointed out by xtkoba (Tee KOBAYASHI) Fixes [Bug #17951] Notes: Merged: https://github.com/ruby/ruby/pull/4574
2021-06-24Actually ignore FNM_CASEFOLD flag in Dir.globJeremy Evans
This was already documented as being ignored, but it wasn't being ignored, causing an issue in a particular case where a UTF-8 pattern was provided and a filename was tested that wasn't valid UTF-8. Fixes [Bug #14456] Notes: Merged: https://github.com/ruby/ruby/pull/4583
2021-06-22Rework `sysread` to use blocking `read_internal_locktmp`.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/4592
2021-06-18ast.rb: RubyVM::AST.parse and .of accepts `save_script_lines: true`Yusuke Endoh
This option makes the parser keep the original source as an array of the original code lines. This feature exploits the mechanism of `SCRIPT_LINES__` but records only the specified code that is passed to RubyVM::AST.of or .parse, instead of recording all parsed program texts. Notes: Merged: https://github.com/ruby/ruby/pull/4581
2021-06-15Time#getlocal tests for [Feature #17544]Nobuyoshi Nakada
2021-06-14[Bug #17880] Set leaf false on opt_setinlinecache (#4565)Eileen M. Uchitelle
This change fixes the bug described in https://bugs.ruby-lang.org/issues/17880. Checking `ractor_shareable_p` will cause the method to call back into Ruby. Anything calling this method can't be a leaf instruction, otherwise it could crash. By adding `attr bool leaf = false` we no longer crash because it marks the function as not a leaf. Here's a simplified reproduction script: ```ruby require "set" class Id attr_reader :db_id def initialize(db_id) @db_id = db_id end def ==(other) other.class == self.class && other.db_id == db_id end alias_method :eql?, :== def hash 10 end def <=>(other) db_id <=> other.db_id if other.is_a?(self.class) end end class Namespace IDS = Set[ Id.new(1).freeze, Id.new(2).freeze, Id.new(3).freeze, Id.new(4).freeze, ].freeze class << self def test?(id) IDS.include?(id) end end end p Namespace.test?(Id.new(1)) p Namespace.test?(Id.new(5)) ``` Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org> Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org> Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2021-06-08Make ENV.clone warn and ENV.dup raiseJeremy Evans
ENV.dup returned a plain Object, since all of ENV's behavior is defined in ENV's singleton class. So using dup makes no sense. ENV.clone works and is used in some gems, but it doesn't do what the user expects, since modifying ENV.clone also modifies ENV. Add a deprecation warning pointing the user to use ENV.to_h instead. This also undefines some private initialize* methods in ENV, since they are not needed. Fixes [Bug #17767] Notes: Merged: https://github.com/ruby/ruby/pull/4557 Merged-By: jeremyevans <code@jeremyevans.net>
2021-06-03Warn more duplicate literal hash keysNobuyoshi Nakada
Following non-special_const literals: * T_REGEXP Notes: Merged: https://github.com/ruby/ruby/pull/4548
2021-06-03Warn more duplicate literal hash keysNobuyoshi Nakada
Following non-special_const literals: * T_BIGNUM * T_FLOAT (non-flonum) * T_RATIONAL * T_COMPLEX Notes: Merged: https://github.com/ruby/ruby/pull/4548
2021-06-03Assertions for duplicate literal hash key warningsNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4548
2021-06-01Make `Thread#native_thread_id` not-implemented if unsupportedNobuyoshi Nakada
Raise `NotImplementedError` on unsupported platforms regardless the argument consistently.
2021-05-29Attempt to fix floating point test failureJeremy Evans
The previous behavior depending on exact float values, it seemed to work OK on amd64 and i386, but other CI platforms are experiencing non-deterministic test failures with it. Relax test slightly to hopefully pass on such platforms.
2021-05-29Fix Enumerator::ArithmeticSequence handling of float rangesJeremy Evans
Depending on the float range, there could be an off-by-one error, where the last result that should be in the range was missed. Fix this by checking if the computed value for the expected value outside the range is still inside the range, and if so, increment the step size. Fixes [Bug #16612] Notes: Merged: https://github.com/ruby/ruby/pull/4434
2021-05-28compile.c: Emit send for === calls in when statementsAlan Wu
The checkmatch instruction with VM_CHECKMATCH_TYPE_CASE calls === without a call cache. Emit a send instruction to make the call instead. It includes a call cache. The call cache improves throughput of using when statements to check the class of a given object. This is useful for say, JSON serialization. Use of a regular send instead of checkmatch also avoids taking the VM lock every time, which is good for multi-ractor workloads. Calculating ------------------------------------- master post vm_case_classes 11.013M 16.172M i/s - 6.000M times in 0.544795s 0.371009s vm_case_lit 2.296 2.263 i/s - 1.000 times in 0.435606s 0.441826s vm_case 74.098M 64.338M i/s - 6.000M times in 0.080974s 0.093257s Comparison: vm_case_classes post: 16172114.4 i/s master: 11013316.9 i/s - 1.47x slower vm_case_lit master: 2.3 i/s post: 2.3 i/s - 1.01x slower vm_case master: 74097858.6 i/s post: 64338333.9 i/s - 1.15x slower The vm_case benchmark is a bit slower post patch, possibily due to the larger instruction sequence. The benchmark dispatches using opt_case_dispatch so was not running checkmatch and does not make the === call post patch. Notes: Merged: https://github.com/ruby/ruby/pull/4468
2021-05-27Fix lazy enumerator with index sizeJeremy Evans
Fixes [Bug #17889] Notes: Merged: https://github.com/ruby/ruby/pull/4534
2021-05-26Rescue NotImplementedError for a test of Thread#native_thread_idYusuke Endoh
http://rubyci.s3.amazonaws.com/solaris10-gcc/ruby-master/log/20210526T070003Z.fail.html.gz ``` 1) Error: TestThread#test_thread_native_thread_id: NotImplementedError: native_thread_id() function is unimplemented on this machine /export/home/users/chkbuild/cb-gcc/tmp/build/20210526T070003Z/ruby/test/ruby/test_thread.rb:1338:in `native_thread_id' /export/home/users/chkbuild/cb-gcc/tmp/build/20210526T070003Z/ruby/test/ruby/test_thread.rb:1338:in `test_thread_native_thread_id' ```
2021-05-26Add Thread#native_thread_id [Feature #17853]NARUSE, Yui
2021-05-26RSS library is the bundled gems nowHiroshi SHIBATA
2021-05-26Ignore lib/irb/ext/tracer.rb with TestRequireLib because tracer library was ↵Hiroshi SHIBATA
removed from ruby repo
2021-05-25Disable compaction on platforms that can't support itAaron Patterson
Manual compaction also requires a read barrier, so we need to disable even manual compaction on platforms that don't support mprotect. [Bug #17871] Notes: Merged: https://github.com/ruby/ruby/pull/4528
2021-05-22Refined portability of test for [Bug #17739]Nobuyoshi Nakada
The order of arguments to callback of qsort is not defined. That means `a` may not be 3 at all.
2021-05-21Do not allow array modifications after freeze inside sort!Jeremy Evans
If freezing an array inside sort!, previously the array could be modified after the freeze. This checks whether the receiver is frozen after every yield and potential call to #> or #<, preventing modifications if the receiver is frozen inside the block or by the #> or #< call. Fixes [Bug #17739] Notes: Merged: https://github.com/ruby/ruby/pull/4335 Merged-By: jeremyevans <code@jeremyevans.net>
2021-05-21Build CDHASH properly when loading iseq from binaryAlan Wu
Before this change, CDHASH operands were built as plain hashes when loaded from binary. Without setting up the hash with the correct st_table type, the hash can sometimes be an ar_table. When the hash is an ar_table, lookups can call the `eql?` method on keys of the hash, which makes the `opt_case_dispatch` instruction not "leaf" as it implicitly declares. The following script trips the stack canary for checking the leaf attribute for `opt_case_dispatch` on VM_CHECK_MODE > 0 (enabled by default with RUBY_DEBUG). rb_vm_iseq = RubyVM::InstructionSequence iseq = rb_vm_iseq.compile(<<-EOF) case Class.new(String).new("foo") when "foo" 42 end EOF puts rb_vm_iseq.load_from_binary(iseq.to_binary).eval This commit changes the binary loading logic to build CDHASH with the right st_table type. The dumping logic and the dump format stays the same Notes: Merged: https://github.com/ruby/ruby/pull/4511 Merged-By: XrXr
2021-05-21Avoid setting the visibility of refinement method entriesAlan Wu
Since refinement search is always performed, these entries should always be public. The method entry that the refinement search returns decides the visibility. Fixes [Bug #17822] Notes: Merged: https://github.com/ruby/ruby/pull/4515
2021-05-21simple rescue+while+break should not use `throw`Koichi Sasada
609de71f043e8ba34f22b9993e444e2e5bb05709 fixes the issue by using `throw` insn if `ensure` is used. However, that patch introduce additional `throw` even if it is not needed. This patch solves the issue. This issue is pointed by @mame. Notes: Merged: https://github.com/ruby/ruby/pull/4507
2021-05-20compile.c: stop the jump-jump optimization if the second has any eventYusuke Endoh
Fixes [Bug #17868]
2021-05-17[Win32] long path name support [Bug #12551]Gabriel Nagy
Implement long path support on Windows by applying Microsoft's recommended application manifest. To make this work on both Visual C++ and MinGW, include the manifest as a resource when generating the resource files. This way it will be embedded into the executables generated by both compilers. It's important for the manifest resource to have ID 1, otherwise GCC will embed a default manifest. Note that in addition to this, the user needs to have [long paths enabled] either by modifying the registry or by enabling a group policy. [long paths enabled]: https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=cmd#enable-long-paths-in-windows-10-version-1607-and-later Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/4505 Merged-By: nobu <nobu@ruby-lang.org>
2021-05-14test/ruby/test_refinement.rb: prevent "assigned but unused variable"Yusuke Endoh
2021-05-13Also `\U` after control/meta is invalid [Bug #17861]Nobuyoshi Nakada
As well as `\u`, `\U` should be invalid there too. And highlight including `u`/`U` not only the backslash before it.
2021-05-12Avoid improper optimization of case statements mixed integer/rational/complexJeremy Evans
Fixes [Bug #17857] Notes: Merged: https://github.com/ruby/ruby/pull/4496
2021-05-12Fix handling of control/meta escapes in literal regexpsJeremy Evans
Ruby uses a recursive algorithm for handling control/meta escapes in strings (read_escape). However, the equivalent code for regexps (tokadd_escape) in did not use a recursive algorithm. Due to this, Handling of control/meta escapes in regexp did not have the same behavior as in strings, leading to behavior such as the following returning nil: ```ruby /\c\xFF/ =~ "\c\xFF" ``` Switch the code for handling \c, \C and \M in literal regexps to use the same code as for strings (read_escape), to keep behavior consistent between the two. Fixes [Bug #14367] Notes: Merged: https://github.com/ruby/ruby/pull/4495
2021-05-13parse.y: Allow "command" syntax in endless method definitionYusuke Endoh
This change allows `def hello = puts "Hello"` without parentheses. Note that `private def hello = puts "Hello"` does not parse for technical reason. [Feature #17398]
2021-05-12suppress warnings on repeat tests.Koichi Sasada
Constant definitions are affect on outer namespace of an anonymous module. To define constants on the anonymous module, this patch uses Module#class_eval(str).
2021-05-12test_cdhash: refactor change class卜部昌平
It is now strange to test Complex in a class named Rational_Test. Notes: Merged: https://github.com/ruby/ruby/pull/4469
2021-05-12cdhash_cmp: can also take complex卜部昌平
There are complex literals `123i`, which can also be a case condition. Notes: Merged: https://github.com/ruby/ruby/pull/4469
2021-05-12cdhash_cmp: rational literals with fractions卜部昌平
Nobu kindly pointed out that rational literals can have fractions. Notes: Merged: https://github.com/ruby/ruby/pull/4469
2021-05-12cdhash_cmp: can take rational literals卜部昌平
Rational literals are those integers suffixed with `r`. They tend to be a part of more complex expressions like `123/456r`, but in theory they can live alone. When such "bare" rational literals are passed to case-when branch, we have to take care of them. Fixes [Bug #17854] Notes: Merged: https://github.com/ruby/ruby/pull/4469
2021-05-11Run nmake check on Actions (#4487)Takashi Kokubun
* Run nmake check on Actions * Skip tests not working in mswin GitHub Actions * Override TEMP * Revert "Skip tests not working in mswin GitHub Actions" This reverts commit 544d2575fcdf23ae63cd25aa03fce10c28b259f2. * Revert "Revert "Skip tests not working in mswin GitHub Actions"" This reverts commit e1f8ad7862c9c4be52dc6e1031a004621eb07e6e. * Fix timeouts * Skip some more broken tests * Update windows.yml * Add a guard for rbasic_spec * Revert "Update windows.yml" This reverts commit bc9694b6b3b9594d406378d15ca11723fb052bc8. * Skip the ensure clause * Simplify the ensure Notes: Merged-By: k0kubun <takashikkbn@gmail.com>