aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/core
Commit message (Collapse)AuthorAgeFilesLines
* Windows: Read ENV names and values as UTF-8 encoded Strings (#3818)Lars Kanis2020-12-084-4/+8
| | | | | | | | | | | | | | | | | | | | | * Windows: Read ENV names and values as UTF-8 encoded Strings Implements issue #12650: fix https://bugs.ruby-lang.org/issues/12650 This also removes the special encoding for ENV['PATH'] and some complexity in the code that is unnecessary now. * Windows: Improve readablity of getenv() encoding getenv() did use the expected codepage as an implicit parameter of the macro. This is mis-leading since include/ruby/win32.h has a different definition. Using the "cp" variable explicit (like the other function calls) makes it more readable and consistent. * Windows: Change external C-API macros getenv() and execv() to use UTF-8 They used to process and return strings with locale encoding, but since all ruby-internal spawn and environment functions use UTF-8, it makes sense to change the C-API equally.
* Removed deprecated Time#succNobuyoshi Nakada2020-12-071-27/+29
|
* Update the version guard to 3.0Nobuyoshi Nakada2020-12-071-1/+1
|
* Hash#index: delete卜部昌平2020-12-071-2/+4
| | | | Has been deprecated since 0c97c8e33584e6203bb09c08f92b63bd2cca8ae7.
* 2.8 -> 3.0 in specsBenoit Daloze2020-12-0412-13/+11
|
* delete deprecated IO-like methods卜部昌平2020-12-039-85/+102
| | | | | | | | | This commit deletes {IO,ARGF,StringIO,Zib::GZipReader}#{bytes,chars,lines,codepoints}, which have been deprecated since c47c095b9740e7c19d6fdca29ab661c1089221d4. Note that String also has those methods. They are neither depreacted nor deleted because they are not aliases of counterpart each_something.
* ENV.index: delete卜部昌平2020-12-021-6/+8
| | | | Has been deprecated since 373282f6656d3d3d989d261e7a95f8e81b5c9712.
* Update to ruby/spec@c4170a3Benoit Daloze2020-11-271-1/+1
|
* Update to ruby/spec@ac878adBenoit Daloze2020-11-279-2/+106
|
* Clarify spec and change of behavior for Random::DEFAULTBenoit Daloze2020-11-271-2/+2
|
* per-ractor Random::DEFAULTKoichi Sasada2020-11-271-2/+15
| | | | | | | | | | Random generators are not Ractor-safe, so we need to prepare per-ractor default random genearators. This patch set `Random::DEFAULT = Randm` (not a Random instance, but the Random class) and singleton methods like `Random.rand()` use a per-ractor random generator. [Feature #17322]
* Use hex-encoded binaries instead of UTF-8Nobuyoshi Nakada2020-11-221-2/+2
| | | | | Which UTF-8 char corresponds to the binary representation is nonsense for other encodings, and just confusing.
* Add string encoding IBM720 alias CP720 (#3803)Lars Kanis2020-11-221-0/+8
| | | | | | The mapping table is generated from the ICU project: https://github.com/unicode-org/icu/blob/master/icu4c/source/data/mappings/ibm-720_P100-1997.ucm Fixes bug 16233 : https://bugs.ruby-lang.org/issues/16233
* Make String methods return String instances when called on a subclass instanceJeremy Evans2020-11-2023-148/+502
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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]
* Improve error message when subclassing non-ClassJeremy Evans2020-11-131-1/+1
| | | | Fixes [Bug #14726]
* Update to ruby/spec@b0b7f53Benoit Daloze2020-11-1317-42/+604
|
* spec/ruby/core/file/utime_spec.rb: XFS seems to have Year 2038 problemYusuke Endoh2020-11-121-3/+7
| | | | | | | | | | | | | | | | | | | | | | https://rubyci.org/logs/rubyci.s3.amazonaws.com/rhel8/ruby-master/log/20201112T123004Z.fail.html.gz ``` 1) File.utime allows Time instances in the far future to set mtime and atime (but some filesystems limit it up to 2446-05-10) FAILED Expected [559444, 2446].include? 2038 to be truthy but was false /home/chkbuild/chkbuild/tmp/build/20201112T123004Z/ruby/spec/ruby/core/file/utime_spec.rb:80:in `block (4 levels) in <top (required)>' /home/chkbuild/chkbuild/tmp/build/20201112T123004Z/ruby/spec/ruby/core/file/utime_spec.rb:3:in `<top (required)>' ``` ``` $ touch foo $ ./miniruby -e 'time = Time.at(1<<44); File.utime(time, time, "foo")' $ ls -l foo -rw-r--r--. 1 mame wheel 0 Jan 19 2038 foo ```
* Make Array methods return Array instances instead of subclass instancesJeremy Evans2020-11-034-28/+86
| | | | | | | | | | | | | | | | 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]
* Fix Rubyspec (ruby-2.7) failuresKazuki Tsujimoto2020-11-011-3/+15
| | | | https://github.com/ruby/ruby/runs/1337845174
* use one-line pattern matching for warning testsKoichi Sasada2020-11-011-2/+2
|
* Assoc pattern matching (#3703)Nobuyoshi Nakada2020-10-261-2/+2
| | | | | [Feature #17260] One-line pattern matching using tASSOC R-assignment is rejected instead.
* Ignore <internal: entries from core library methods for Kernel#warn(message, ↵Benoit Daloze2020-10-262-0/+30
| | | | | | uplevel: n) * Fixes [Bug #17259]
* Add specs that #caller and #caller_locations include core library methods ↵Benoit Daloze2020-10-262-0/+24
| | | | defined in Ruby
* Update to ruby/spec@4f59d86Benoit Daloze2020-10-2429-52/+390
|
* numeric.c, range.c: prohibit zero stepKenta Murata2020-10-234-49/+92
| | | | | | | | | * numeric.c: prohibit zero step in Numeric#step * range.c: prohibit zero step in Range#step * Fix ruby-spec [Feature #15573]
* Fix typos [ci skip]Kazuhiro NISHIYAMA2020-10-191-1/+1
|
* relax Fiber#transfer's restrictionKoichi Sasada2020-10-121-3/+34
| | | | | | | | | | | | | | | | | | | | | | | | | Using Fiber#transfer with Fiber#resume for a same Fiber is limited (once Fiber#transfer is called for a fiber, the fiber can not be resumed more). This restriction was introduced to protect the resume/yield chain, but we realized that it is too much to protect the chain. Instead of the current restriction, we introduce some other protections. (1) can not transfer to the resuming fiber. (2) can not transfer to the yielding fiber. (3) can not resume transferred fiber. (4) can not yield from not-resumed fiber. [Bug #17221] Also at the end of a transferred fiber, it had continued on root fiber. However, if the root fiber resumed a fiber (and that fiber can resumed another fiber), this behavior also breaks the resume/yield chain. So at the end of a transferred fiber, switch to the edge of resume chain from root fiber. For example, root fiber resumed f1 and f1 resumed f2, transferred to f3 and f3 terminated, then continue from the fiber f2 (it was continued from root fiber without this patch).
* Make the test suite pass on real Android/Termux environmentYusuke Endoh2020-10-122-2/+2
| | | | Attempting to create a hard link raises EACCES
* Removed meaningless system dependent testsNobuyoshi Nakada2020-10-021-18/+0
| | | | | | As [Bug #16662] lchmod available in linux since glibc 2.31.9000, a system call may exist or not exist depending on the version. It is not a spec nor responsibility of Ruby.
* spec/ruby/core/process/spawn_spec.rb: skip a test on AndroidYusuke Endoh2020-10-011-1/+1
| | | | | | | | | | | | | On Android, STDERR seems to be open even its invoker closes it. http://rubyci.s3.amazonaws.com/android29-x86_64/ruby-master/log/20201001T014315Z.fail.html.gz ``` 1) Process.spawn closes STDERR in the child if :err => :close FAILED Expected (59840): "out\nrescued\n" but got: "out\n" ```
* Update to ruby/spec@bfd843aBenoit Daloze2020-09-307-58/+48
|
* Update to ruby/spec@681e8cfBenoit Daloze2020-09-302-8/+10
|
* Update to ruby/spec@9277d27Benoit Daloze2020-09-306-6/+86
|
* Add rb_category_warn{,ing} for warning messages with categoriesJeremy Evans2020-09-282-9/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the following C-API functions that can be used to emit warnings with categories included: ```c void rb_category_warn(const char *, const char*, ...) void rb_category_warning(const char*, const char*, ...) ``` Internally in error.c, there is an rb_warn_category function that will call Warning.warn with the string and the category keyword if it doesn't have an arity of 1, and will call Warning.warn with just the string if it has an arity of 1. This refactors the rb_warn_deprecated{,_to_remove} functions to use rb_warn_category. This makes Kernel#warn accept a category keyword and pass it to Warning.warn, so that Ruby methods can more easily emit warnings with categories. rb_warn_category makes sure that the passed category is a already defined category symbol before calling Warning.warn. The only currently defined warning category is :deprecated, since that is what is already used. More categories can be added in later commits.
* Clarify spec description for Hash#{each,each_pair}Benoit Daloze2020-09-281-1/+1
|
* freeze all Range objects.v3_0_0_preview1Koichi Sasada2020-09-252-3/+8
| | | | | Matz want to try to freeze all Range objects. [Feature #15504]
* Disable deprecation warning by the default [Feature #16345]Nobuyoshi Nakada2020-09-255-29/+45
| | | | And `-w` option turns it on.
* Revert "Prevent SystemStackError when calling super in module with activated ↵Jeremy Evans2020-09-221-59/+20
| | | | | | | | | | | | | | refinement" This reverts commit eeef16e190cdabc2ba474622720f8e3df7bac43b. This also reverts the spec change. Preventing the SystemStackError would be nice, but there is valid code that the fix breaks, and it is probably more common than cases that cause the SystemStackError. Fixes [Bug #17182]
* Make Thread#join always convert its argument, as before 70f08f1eedBenoit Daloze2020-09-211-3/+2
|
* Fix Thread leak in Thread#join specsBenoit Daloze2020-09-211-1/+2
|
* Make `Thread#join` non-blocking.Samuel Williams2020-09-211-0/+5
|
* Update to ruby/spec@e829fb0Benoit Daloze2020-09-1711-118/+143
|
* Warn on a finalizer that captures the object to be finalizedChris Seaton2020-09-161-12/+116
| | | | | Also improve specs and documentation for finalizers and more clearly recommend a safe code pattern to use them.
* 2.8 -> 3.0 in specsBenoit Daloze2020-09-1528-53/+51
|
* Make Mutex per-Fiber instead of per-ThreadBenoit Daloze2020-09-141-0/+12
| | | | | | | | | * Enables Mutex to be used as synchronization between multiple Fibers of the same Thread. * With a Fiber scheduler we can yield to another Fiber on contended Mutex#lock instead of blocking the entire thread. * This also makes the behavior of Mutex consistent across CRuby, JRuby and TruffleRuby. * [Feature #16792]
* Fix constant names set using const_set on a singleton classMarc-Andre Lafortune2020-09-022-8/+28
| | | | Fixes [Bug #14895]
* Deprecate iterator? methodNobuyoshi Nakada2020-08-311-6/+8
| | | | [Feature #15547] [Fix GH-2071]
* Thread.exclusive: delete卜部昌平2020-08-311-32/+34
| | | | | | Has been deprecated since 2069c9e031fc968d6d3d0fe30a9316851e4d91d8. [Feature #17125][ruby-core:99636]
* Update to ruby/spec@335eb9bBenoit Daloze2020-08-2814-332/+501
|
* States Time.at expects rational-like argument to respond to #to_intNobuyoshi Nakada2020-08-281-0/+6
| | | | https://bugs.ruby-lang.org/issues/17131