[#101179] Spectre Mitigations — Amel <amel.smajic@...>
Hi there!
5 messages
2020/12/01
[#101694] Ruby 3.0.0 Released — "NARUSE, Yui" <naruse@...>
V2UgYXJlIHBsZWFzZWQgdG8gYW5ub3VuY2UgdGhlIHJlbGVhc2Ugb2YgUnVieSAzLjAuMC4gRnJv
4 messages
2020/12/25
[ruby-core:101421] [Ruby master Bug#13663] `String#upto` doesn't work as expected
From:
merch-redmine@...
Date:
2020-12-12 02:33:27 UTC
List:
ruby-core #101421
Issue #13663 has been updated by jeremyevans0 (Jeremy Evans).
Status changed from Open to Closed
At the December 2020 development meeting, @matz agreed the current behavior=
is expected and this is not a bug.
----------------------------------------
Bug #13663: `String#upto` doesn't work as expected
https://bugs.ruby-lang.org/issues/13663#change-89182
* Author: sos4nt (Stefan Sch=FC=DFler)
* Status: Closed
* Priority: Normal
* ruby -v: ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin15]
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
Given that `String#upto` uses `String#succ` to generate successive values, =
I'd expect
```ruby
'x'.upto('ac').to_a #=3D> []
```
to return:
```ruby
["x", "y", "z", "aa", "ab", "ac"]
```
Instead, an empty array is returned.
This seems to depend on whether the the receiver is greater than the argume=
nt or not:
```ruby
'x' <=3D> 'ac' #=3D> 1
```
It works just fine in this case:
```ruby
'b'.upto('ca').to_a
#=3D> ["b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n",
# "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "aa",
# "ab", "ac", "ad", "ae", "af", "ag", "ah", "ai", "aj", "ak", "al",
# "am", "an", "ao", "ap", "aq", "ar", "as", "at", "au", "av", "aw",
# "ax", "ay", "az", "ba", "bb", "bc", "bd", "be", "bf", "bg", "bh",
# "bi", "bj", "bk", "bl", "bm", "bn", "bo", "bp", "bq", "br", "bs",
# "bt", "bu", "bv", "bw", "bx", "by", "bz", "ca"]
```
Presumably because of:
```ruby
'b' <=3D> 'ca' #=3D> -1
```
-- =
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=3Dunsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>