summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2020-11-20Make String methods return String instances when called on a subclass instanceJeremy Evans
This modifies the following String methods to return String instances instead of subclass instances: * String#* * String#capitalize * String#center * String#chomp * String#chop * String#delete * String#delete_prefix * String#delete_suffix * String#downcase * String#dump * String#each/#each_line * String#gsub * String#ljust * String#lstrip * String#partition * String#reverse * String#rjust * String#rpartition * String#rstrip * String#scrub * String#slice! * String#slice/#[] * String#split * String#squeeze * String#strip * String#sub * String#succ/#next * String#swapcase * String#tr * String#tr_s * String#upcase This also fixes a bug in String#swapcase where it would return the receiver instead of a copy of the receiver if the receiver was the empty string. Some string methods were left to return subclass instances: * String#+@ * String#-@ Both of these methods will return the receiver (subclass instance) in some cases, so it is best to keep the returned class consistent. Fixes [#10845] Notes: Merged: https://github.com/ruby/ruby/pull/3701
2020-11-20Do not allow Module#include to insert modules before the origin in the ↵Jeremy Evans
lookup chain Module#include should only be able to insert modules after the origin, otherwise it ends up working like Module#prepend. This fixes the case where one of the modules in the included module chain is included in a module that is already prepended to the receiver. Fixes [Bug #7844] Notes: Merged: https://github.com/ruby/ruby/pull/3796
2020-11-20Update expected IRB resultNobuyoshi Nakada
2020-11-20[Bug #11213] let defined?(super) call respond_to_missing?Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/3777
2020-11-20Ripper.{lex,tokenize} return full tokens even if syntax errorNobuhiro IMAI
yet another implements [Feature #17276]
2020-11-19Added assertionsNobuyoshi Nakada
2020-11-19Make RubyVM::InstructionSequence.compile_file use same encoding as loadJeremy Evans
This switches the internal function from rb_parser_compile_file_path to rb_parser_load_file, which is the same internal method that Kernel#load uses. Fixes [Bug #17308] Notes: Merged: https://github.com/ruby/ruby/pull/3788
2020-11-17Support raise_errors keyword for Ripper.{lex,tokenize,sexp,sexp_raw}Jeremy Evans
Implements [Feature #17276] Notes: Merged: https://github.com/ruby/ruby/pull/3774 Merged-By: jeremyevans <code@jeremyevans.net>
2020-11-18[ruby/fiddle] test: suppress shadowing outer local variable warningSutou Kouhei
https://github.com/ruby/fiddle/commit/cf168680a2 Notes: Merged: https://github.com/ruby/ruby/pull/3780
2020-11-18[ruby/fiddle] Add a "pinning" reference (#44)Aaron Patterson
* Add a "pinning" reference A `Fiddle::Pinned` objects will prevent the objects they point to from moving. This is useful in the case where you need to pass a reference to a C extension that keeps the address in a global and needs the address to be stable. For example: ```ruby class Foo A = "hi" # this is an embedded string some_c_function A # A might move! end ``` If `A` moves, then the underlying string buffer may also move. `Fiddle::Pinned` will prevent the object from moving: ```ruby class Foo A = "hi" # this is an embedded string A_pinner = Fiddle::Pinned.new(A) # :nodoc: some_c_function A # A can't move because of `Fiddle::Pinned` end ``` This is a similar strategy to what Graal uses: https://www.graalvm.org/sdk/javadoc/org/graalvm/nativeimage/PinnedObject.html#getObject-- * rename global to match exception name * Introduce generic Fiddle::Error and rearrange error classes Fiddle::Error is the generic exception base class for Fiddle exceptions. This commit introduces the class and rearranges Fiddle exceptions to inherit from it. https://github.com/ruby/fiddle/commit/ac52d00223 Notes: Merged: https://github.com/ruby/ruby/pull/3780
2020-11-18[ruby/fiddle] Add support for specifying types by name as String or SymbolSutou Kouhei
For example, :voidp equals to Fiddle::TYPE_VOID_P. https://github.com/ruby/fiddle/commit/3b4de54899 Notes: Merged: https://github.com/ruby/ruby/pull/3780
2020-11-18[ruby/fiddle] Add TYPE_CONST_STRING and SIZEOF_CONST_STRING for "const char *"Sutou Kouhei
Add rb_fiddle_ prefix to conversion functions.h to keep backward compatibility but value_to_generic() isn't safe for TYPE_CONST_STRING and not String src. Use rb_fiddle_value_to_generic() instead. https://github.com/ruby/fiddle/commit/0ffcaa39e5 Notes: Merged: https://github.com/ruby/ruby/pull/3780
2020-11-18test/net/smtp - use TCPSocket when UNIXSocket unavailableMSP-Greg
Notes: Merged: https://github.com/ruby/ruby/pull/3778
2020-11-17Skip tests related TLS with Windows platform.Hiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/3776
2020-11-17Import net-smtp-0.2.0 from https://github.com/ruby/net-smtpHiroshi SHIBATA
2020-11-16Fix singleton class cloningAlan Wu
Before this commit, `clone` gave different results depending on whether the original object had an attached singleton class or not. Consider the following setup: ``` class Foo; end Foo.singleton_class.define_method(:foo) {} obj = Foo.new obj.singleton_class if $call_singleton clone = obj.clone ``` When `$call_singleton = false`, neither `obj.singleton_class.singleton_class` nor `clone.singleton_class.singleton_class` own any methods. However, when `$call_singleton = true`, `clone.singleton_class.singleton_class` would own a copy of `foo` from `Foo.singleton_class`, even though `obj.singleton_class.singleton_class` does not. The latter case is unexpected and results in a visibly different clone, depending on if the original object had an attached class or not. Co-authored-by: Ufuk Kayserilioglu <ufuk.kayserilioglu@shopify.com> Notes: Merged: https://github.com/ruby/ruby/pull/3761
2020-11-17remain enabled and line specified trace pointsKoichi Sasada
If two or more tracepoints enabled with the same target and with different target lines, the only last line is activated. This patch fixes this issue by remaining existing trace instructions. [Bug #17302] Notes: Merged: https://github.com/ruby/ruby/pull/3770
2020-11-13[ruby/webrick] Allow empty POST and PUT requests without content lengthJeremy Evans
RFC 7230 section 3.3.3 allows for this. Fixes #30 https://github.com/ruby/webrick/commit/069e9b1908
2020-11-11Removed win32apiHiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/3712
2020-11-10[ruby/racc] skip the failing test with JRubyHiroshi SHIBATA
https://github.com/ruby/racc/commit/cf37713895
2020-11-10lib/racc/statetransitiontable.rb: Make the racc output stableYusuke Endoh
Racc calls `Array#sort!` to build a state transition table. As `Array#sort!` is not a stable sort, the output may differ depending upon the environment. This changeset makes the sort stable manually, and updates all expectation files. Notes: Merged: https://github.com/ruby/ruby/pull/3749
2020-11-09`fe80` should be case insensitive tooKazuhiro NISHIYAMA
2020-11-08Fix TestFiberMutex#test_condition_variable assertionBenoit Daloze
* Now that it works correctly.
2020-11-08test/resolv/test_dns.rb: suppress "assigned but unused variable"Yusuke Endoh
2020-11-08Urgent notification pipe has same lifetime as scheduler.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/3743
2020-11-08Defer `kernel_sleep` to `block` to avoid exiting the event loop when ↵Samuel Williams
duration is nil. Notes: Merged: https://github.com/ruby/ruby/pull/3743
2020-11-07Add support for IPv6 link local addresses to resolvJeremy Evans
Now that it should work correctly, test that every address returned by Socket.ip_address_list is resolvable. Socket works with IPv6 link local addresses, and ipaddr now does as well, so I think resolv should support them. Fixes [Bug #17112] Notes: Merged: https://github.com/ruby/ruby/pull/3452
2020-11-07Remove sender/message_id pair after response received in resolvJeremy Evans
Once a response for a given DNS request has been received (which requires a matching message id), the [sender, message_id] pair should be removed from the list of valid senders. This makes it so duplicate responses from the same sender are ignored. Fixes [Bug #12838] Notes: Merged: https://github.com/ruby/ruby/pull/3536
2020-11-07Rename to `Fiber#set_scheduler`.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/3742
2020-11-03Make Array methods return Array instances instead of subclass instancesJeremy Evans
This changes the following methods to return Array instances instead of subclass instances: * Array#drop * Array#drop_while * Array#flatten * Array#slice! * Array#slice/#[] * Array#take * Array#take_while * Array#uniq * Array#* Fixes [Bug #6087] Notes: Merged: https://github.com/ruby/ruby/pull/3690 Merged-By: jeremyevans <code@jeremyevans.net>
2020-11-04Rightward assignment is replaced by one-line pattern matchingKazuki Tsujimoto
2020-11-03test/ruby/test_gc_compact.rb: suppress "assigned but unused variable"Yusuke Endoh
2020-11-02Add `GC.auto_compact= true/false` and `GC.auto_compact`Aaron Patterson
* `GC.auto_compact=`, `GC.auto_compact` can be used to control when compaction runs. Setting `auto_compact=` to true will cause compaction to occurr duing major collections. At the moment, compaction adds significant overhead to major collections, so please test first! [Feature #17176]
2020-11-02ripper: Invalid pragma value warningNobuyoshi Nakada
2020-11-01Pattern matching is no longer experimentalKazuki Tsujimoto
2020-10-29check isolated Proc more strictlyKoichi Sasada
Isolated Proc prohibit to access outer local variables, but it was violated by binding and so on, so they should be error. Notes: Merged: https://github.com/ruby/ruby/pull/3721
2020-10-28Add Thread.ignore_deadlock accessorJeremy Evans
Setting this to true disables the deadlock detector. It should only be used in cases where the deadlock could be broken via some external means, such as via a signal. Now that $SAFE is no longer used, replace the safe_level_ VM flag with ignore_deadlock for storing the setting. Fixes [Bug #13768] Notes: Merged: https://github.com/ruby/ruby/pull/3710 Merged-By: jeremyevans <code@jeremyevans.net>
2020-10-28test/ruby/test_rational.rb: Prevent "assigned but unused variable"Yusuke Endoh
2020-10-27Revert "Fixed typo"Nobuyoshi Nakada
This reverts commit 379a5ca539af0e954b1cdf63b9365ad208b9c7f3. This "typo" is intentional to test the transposition detection by did_you_mean.
2020-10-27Fixed typoHiroshi SHIBATA
2020-10-26Allow non-argument endless-def with a space instead of parenthesesNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/3704
2020-10-26rational.c: convert a numerator to rational before calling fdiv in ↵Kenta Murata
Kernel.Rational() (#3702) This makes `Rational(BigDecimal(1), 60) == Rational(1, 60)`. [Bug #16518] Notes: Merged-By: mrkn <mrkn@ruby-lang.org>
2020-10-26Assoc pattern matching (#3703)Nobuyoshi Nakada
[Feature #17260] One-line pattern matching using tASSOC R-assignment is rejected instead. Notes: Merged-By: nobu <nobu@ruby-lang.org>
2020-10-23numeric.c, range.c: prohibit zero stepKenta Murata
* numeric.c: prohibit zero step in Numeric#step * range.c: prohibit zero step in Range#step * Fix ruby-spec [Feature #15573] Notes: Merged: https://github.com/ruby/ruby/pull/3689 Merged-By: mrkn <mrkn@ruby-lang.org>
2020-10-22rational.c: try converting by to_int in Rational() (#3684)Kenta Murata
[Bug #12485] Notes: Merged-By: mrkn <mrkn@ruby-lang.org>
2020-10-21test/json/json_parser_test.rb: suppress warningsYusuke Endoh
http://rubyci.s3.amazonaws.com/ubuntu/ruby-master/log/20201021T123003Z.log.html.gz ``` /home/chkbuild/chkbuild/tmp/build/20201021T123003Z/ruby/test/json/json_parser_test.rb:227: warning: ambiguous first argument; put parentheses or a space even after `-' operator /home/chkbuild/chkbuild/tmp/build/20201021T123003Z/ruby/test/json/json_parser_test.rb:228: warning: ambiguous first argument; put parentheses or a space even after `-' operator ```
2020-10-21Feature #16812: Allow slicing arrays with ArithmeticSequence (#3241)Kenta Murata
* Support ArithmeticSequence in Array#slice * Extract rb_range_component_beg_len * Use rb_range_values to check Range object * Fix ary_make_partial_step * Fix for negative step cases * range.c: Describe the role of err argument in rb_range_component_beg_len * Raise a RangeError when an arithmetic sequence refers the outside of an array [Feature #16812] Notes: Merged-By: mrkn <mrkn@ruby-lang.org>
2020-10-20strip trailing spaces [ci skip]Nobuyoshi Nakada
2020-10-20Fix an issue with generate_pretty and empty objects in the Ruby and Java ↵Chris Seaton
implementations
2020-10-20Implement a freeze: parser optionJean Boussier
If set to true all parsed objects will be immediately frozen, and strings will be deduplicated if the Ruby implementation allows it.