Граф коммитов

16563 Коммитов

Автор SHA1 Сообщение Дата
Stan Lo 50e77b6a9c [ruby/irb] Improve RubyLex's tests
(https://github.com/ruby/irb/pull/484)

* Improve assert_indenting helper

Instead of putting assertions inside the `auto_indent` block, we
can just make `auto_indent` return the calculated space count, and use
it for assertion outside of the `auto_indent` block call.

This simplifies the setup code and makes the intention easier to
understand.

* Introduce assert_row_indenting helper

1. Helper users shouldn't need to write 2 assertions for the current and
   the next line's indentation.
2. With this new approach, we can generate clearer error message for
   both cases:

When the current line's space count doesn't match

```
  Incorrect spaces calculation for line:

  ```
> def each_top_level_statement
  ```

  All lines:

  ```
  def each_top_level_statement
  ```

<0> expected but was
<nil>
```

When the next line's space count doesn't match

```
  Incorrect spaces calculation for line after the current line:

  ```
  def each_top_level_statement
>
  ```

  All lines:

  ```
  def each_top_level_statement
  ```

<3> expected but was
<2>
```

* Replace assert_indenting with assert_row_indenting
2023-02-21 19:38:09 +00:00
Peter Zhu 93ac7405b8 Add marking and sweeping time to GC.stat
There is a `time` key in GC.stat that gives us the total time spent in
GC. However, we don't know what proportion of the time is spent between
marking and sweeping. This makes it difficult to tune the GC as we're
not sure where to focus our efforts on.

This PR adds keys `marking_time` and `sweeping_time` to GC.stat for the
time spent marking and sweeping, in milliseconds.

[Feature #19437]
2023-02-21 08:05:31 -05:00
Charles Oliver Nutter 4c7726516c [ruby/strscan] Mask out this test on JRuby/Windows
See https://github.com/jruby/jruby/issues/7644 for the root issue,
which will require fixes to JRuby's regular expression engine,
JOni.

https://github.com/ruby/strscan/commit/29a65abff2
2023-02-21 19:31:39 +09:00
Sutou Kouhei 76a4cdfb02 [ruby/strscan] test: Run test more with fixed anchor mode
(https://github.com/ruby/strscan/pull/60)

fix https://github.com/ruby/strscan/pull/56
2023-02-21 19:31:38 +09:00
OKURA Masafumi 260bc7cdfa [ruby/strscan] Add test case to `test_string`
(https://github.com/ruby/strscan/pull/58)

`string` returns the original string after `scan` is called. Current
test doesn't check this behavior and now it's covered.
2023-02-21 19:31:38 +09:00
Sutou Kouhei a350ef9f7a [ruby/csv] test: use mailing list ID instead of unavailable URL
https://github.com/ruby/csv/commit/04862ccf87
2023-02-21 19:31:29 +09:00
Vivek Bharath Akupatni 2ac1efc0f3 [ruby/csv] Use https links instead of http
(https://github.com/ruby/csv/pull/274)

https://github.com/ruby/csv/commit/e2a06929a8
2023-02-21 19:31:29 +09:00
Hiroshi SHIBATA 38fa8eb4cb Merge rubygems/bundler master
Pick from e9304aed7e
2023-02-21 19:28:12 +09:00
dependabot[bot] ba2bd6d0f1 [rubygems/rubygems] Bump rb-sys
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.64 to 0.9.65.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.64...v0.9.65)

---
updated-dependencies:
- dependency-name: rb-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-21 10:05:41 +00:00
Yusuke Endoh 6384f7981c Prevent "warning: ambiguity between regexp and two divisions"
http://rubyci.s3.amazonaws.com/ubuntu/ruby-master/log/20230221T031004Z.log.html.gz
```
/home/chkbuild/chkbuild/tmp/build/20230221T031004Z/ruby/test/rubygems/test_gem_ext_cargo_builder.rb:90: warning: ambiguity between regexp and two divisions: wrap regexp in parentheses or add a space after `/' operator
```
2023-02-21 13:46:11 +09:00
Takashi Kokubun ecd0cdaf82
YJIT: Fix assertion for partially mapped last pages (#7337)
Follows up [Bug #19400]
2023-02-20 09:06:09 -08:00
Yusuke Endoh 8f868a1a65 Update some tests for the new message format of NoMethodError 2023-02-20 10:33:06 +09:00
Eric Wong 924ab1b7fd test/readline/test_readline.rb: skip a test x86_64-linux-(x32|i[3-6]86)
I run a 32-bit (x86) userspace on a 64-bit kernel to save memory
and this test fails for the same reason it does on pure 32-bit
platforms.

Followup-to: 6cf7c0a48f (test/readline/test_readline.rb: skip a test on i686-linux, 2021-11-09)
2023-02-19 22:39:28 +00:00
Yusuke Endoh 29f88b9fea [ruby/error_highlight] Support the new message format of NameError in Ruby 3.3
https://bugs.ruby-lang.org/issues/18285
https://github.com/ruby/ruby/pull/6950

https://github.com/ruby/error_highlight/commit/a7c2da052e
2023-02-19 10:29:56 +00:00
Yusuke Endoh 4dc2cb3c1a [ruby/did_you_mean] Support the new message format of NameError in
Ruby 3.3
(https://github.com/ruby/did_you_mean/pull/184)

This change accepts the following change of the message of NameError in
a test.

https://bugs.ruby-lang.org/issues/18285#note-37

```
old: undefined method `sizee' for #<File:...>
new: undefined method `sizee' for an instance of File
```
2023-02-19 07:10:47 +00:00
Maciej Rzasa 36e3d46d35 [ruby/bigdecimal] Handle correctly #remainder with infinity. Fixes
https://github.com/ruby/bigdecimal/pull/187

https://github.com/ruby/bigdecimal/commit/4b8572d452
2023-02-17 17:46:27 +00:00
Nobuyoshi Nakada dd28c55a7c
[Bug#19445] Fix keyword splat in enumerator
Extracted arguments do not have keyword hash to splat.
2023-02-17 10:57:22 +09:00
Alan Wu a4b7ec1229 YJIT: Fix false assumption that String#+@ => ::String
Could return a subclass.

[Bug #19444]
2023-02-16 18:50:42 -05:00
Alan Wu c178926fbe YJIT: jit_prepare_routine_call() for String#+@ missing
We saw SEGVs due to this when running with StackProf, which needs a
correct PC for RUBY_INTERNAL_EVENT_NEWOBJ, the same event used for
ObjectSpace allocation tracing.

[Bug #19444]
2023-02-16 18:50:42 -05:00
Haldun Bayhantopcu 0b4b2cd1ee Fix removing ivars from clases and modules.
Co-authored-by: Adam Hess <hparker@github.com>
2023-02-15 15:43:46 -08:00
Benoit Daloze 70d84a5f3d [ruby/timeout] Simplify test
https://github.com/ruby/timeout/commit/db017da726
2023-02-15 19:25:05 +00:00
Rick Blommers 610375edfc [ruby/timeout] Don't move the timer_thread when it's enclosed
Don't move the timer_thread to ThreadGroup::Default, when it's
created in an enclosed ThreadGroup.
Prevents the exception: "add" can't move from the enclosed thread group"

https://github.com/ruby/timeout/commit/eb889d2c8b
2023-02-15 19:25:05 +00:00
dependabot[bot] e5e506095c [rubygems/rubygems] Bump rb-sys
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.61 to 0.9.64.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.61...v0.9.64)

---
updated-dependencies:
- dependency-name: rb-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-14 13:59:32 +00:00
Nobuyoshi Nakada 45f0e3a673
[Bug #19259] `Data#with` should call `initialize` method 2023-02-14 12:02:07 +09:00
tomoya ishida f313514563 [ruby/irb] Fix colorize backtick symbol
(https://github.com/ruby/irb/pull/508)

https://github.com/ruby/irb/commit/dd7f25cd45

Co-authored-by: Stan Lo <stan001212@gmail.com>
2023-02-12 20:27:32 +00:00
Koichi Sasada be94808282 use correct svar even if env is escaped
This patch is follo-up of 0a82bfe.
Without this patch, if env is escaped (Proc'ed), strange svar
can be touched.

This patch tracks escaped env and use it.
2023-02-10 17:55:25 +09:00
Satadru Pramanik, DO, MPH, MEng 94aed6ece5 [ruby/fileutils] Add mkdir_p to FileUtils.install
(https://github.com/ruby/fileutils/pull/104)

* Add mkdir_p to FileUtils.install

* Adjust raise message.

* adjust raise language

* handle trailing slash in dest

* simplify

* Add tests
2023-02-10 03:37:39 +00:00
Mike Perham 194520f80e [ruby/logger] Add Logger#with_level{...} for block-scoped log level.
(https://github.com/ruby/logger/pull/85)

* Update lib/logger/severity.rb

https://github.com/ruby/logger/commit/7aabb0b4aa
2023-02-10 01:08:49 +00:00
eileencodes b9e6580135 Copy cvar table on clone
When a class with a class variable is cloned we need to also copy the
cvar cache table from the original table to the clone. I found this bug
while working on fixing [Bug #19379]. While this does not fix that bug
directly it is still a required change to fix another bug revealed by
the fix in https://github.com/ruby/ruby/pull/7265

This needs to be backported to 3.2.x and 3.1.x.

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2023-02-09 11:24:32 -08:00
Stan Lo 970e7cdec3 [ruby/irb] Make tests more compatible with TruffleRuby
(https://github.com/ruby/irb/pull/514)

* Improve encoding error test case

The test input IRB currently uses happen to hit a compatibility bug in
TruffleRuby, which has been documented in
https://github.com/oracle/truffleruby/issues/2848

Although it'll eventually be fixed, we can make the test case support TruffleRuby
now by tweaking it just a little bit.

Co-authored-by: Kevin Menard <kevin@nirvdrum.com>

* Remove redundant TruffleRuby omits/pends

Co-authored-by: Kevin Menard <kevin@nirvdrum.com>

* Use a different way to test warning emission

The test case was added in d08ef68d2d
to verify that IRB emits Ruby warning as expected.

But the subject it uses relies on CRuby's regexp engine, which isn't always
used in other language implementations, like TruffleRuby. That's why we
ended up skipping TruffleRuby in this test case.

Since the test isn't about regexp itself, we can change the testing subject
and just remove the special condition for TruffleRuby.

Co-authored-by: Kevin Menard <kevin@nirvdrum.com>

---------

https://github.com/ruby/irb/commit/6fdf4f3e97

Co-authored-by: Kevin Menard <kevin@nirvdrum.com>
2023-02-09 15:33:37 +00:00
Nobuyoshi Nakada da4464b824
[Bug #19426] Fix endless `Range#step` with `#succ` method 2023-02-09 20:37:34 +09:00
Jean byroot Boussier 8ce2fb9bbb Only emit circular dependency warning for owned thread shields
[Bug #19415]

If multiple threads attemps to load the same file concurrently
it's not a circular dependency issue.

So we check that the existing ThreadShield is owner by the current
fiber before warning about circular dependencies.
2023-02-08 09:50:00 +01:00
Jean Boussier 3ab3455145 Add RUBY_GC_HEAP_INIT_SIZE_%d_SLOTS to pre-init pools granularly
The old RUBY_GC_HEAP_INIT_SLOTS isn't really usable anymore as
it initalize all the pools by the same factor, but it's unlikely
that pools will need similar sizes.

In production our 40B pool is 5 to 6 times bigger than our 80B pool.
2023-02-08 09:26:07 +01:00
Jean Boussier 1e71143976 Use more agressive RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR for GC tests 2023-02-07 22:33:12 +01:00
dependabot[bot] c84184d50b [rubygems/rubygems] Bump rb-sys
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.58 to 0.9.61.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.58...v0.9.61)

---
updated-dependencies:
- dependency-name: rb-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-06 23:38:12 +00:00
zzak 773d56b1c1 [ruby/rdoc] Add test coverage for -C flag
https://github.com/ruby/rdoc/commit/564be08f4b
2023-02-06 23:09:06 +00:00
Jean byroot Boussier c19defd026 Revert "Only emit circular dependency warning for owned thread shields"
This reverts commit fa49651e05.
2023-02-06 23:30:35 +01:00
Jean Boussier fa49651e05 Only emit circular dependency warning for owned thread shields
[Bug #19415]

If multiple threads attemps to load the same file concurrently
it's not a circular dependency issue.

So we check that the existing ThreadShield is owner by the current
fiber before warning about circular dependencies.
2023-02-06 19:35:38 +01:00
Jemma Issroff 28da990984 Limit maximum number of IVs on a shape on T_OBJECTS
Create SHAPE_MAX_NUM_IVS (currently 50) and limit all shapes of
T_OBJECTS to that number of IVs. When a shape with a T_OBJECT has more than 50 IVs, fall back to the
obj_too_complex shape which uses hash lookup for ivs.

Note that a previous version of this commit
78fcc9847a was reverted in
88f2b94065 because it did not account for
non-T_OBJECTS
2023-02-06 08:40:51 -08:00
tompng 91f353b1c3 [ruby/reline] Fix line rendering when newline is added at the end of the buffer
https://github.com/ruby/reline/commit/7d61b3df9a
2023-02-06 14:23:59 +00:00
Sorah Fukumori 8a29419b7f [ruby/reline] test_dumb_terminal: "ruby" command is not always available
Fixes the same issue at https://github.com/ruby/ruby/pull/5417

`ruby` is not always available in certain build environments and
configure options (e.g. --program-suffix)

This patch tries to choose an appropriate command line for spawning a
fresh Ruby process, based on EnvUtil implementation in ruby/ruby's test
suite.

Plus when this library is directly mirrored into ruby/ruby, prefer EnvUtil
available there over the implementation in this library's test suite.

https://github.com/ruby/reline/commit/278327d2e9
2023-02-05 20:31:37 +00:00
Stan Lo 295fc59eda [ruby/irb] Add tests for workspaces commands
(https://github.com/ruby/irb/pull/512)

https://github.com/ruby/irb/commit/874dbcad81
2023-02-04 22:31:17 +00:00
Nobuyoshi Nakada 0a02c51a06 [rubygems/rubygems] Ensure that `TempIO` is closed
https://github.com/rubygems/rubygems/commit/0cbb7b5370
2023-02-04 19:38:55 +00:00
Nobuyoshi Nakada e37bf46ed5 [rubygems/rubygems] Fix Tempfile leaks
https://github.com/rubygems/rubygems/commit/f95d1a87ce
2023-02-04 19:38:55 +00:00
zzak e04d20bc48 [ruby/rdoc] Add rdoc:coverage default task
https://github.com/ruby/rdoc/commit/157fbaf575
2023-02-03 23:41:06 +00:00
Martin Emde 0853703ec6 [rubygems/rubygems] Test to show non-standard behavior of zero byte files in archive
Added more tests for some of the other behavior as well.
Tests were missing for readpartial with a buffer, and reading
remaining bytes after a partial read, using StringIO as reference.

https://github.com/rubygems/rubygems/commit/d600a657b1
2023-02-02 17:17:33 +00:00
Takashi Kokubun 1c5bd01363
Add a test for svar #7225 (#7228) 2023-02-01 21:47:45 -08:00
Nobuyoshi Nakada fad48fefe1 [Bug #19399] Parsing invalid heredoc inside block parameter
Although this is of course invalid as Ruby code, allow to just parse
and tokenize.
2023-02-02 12:20:10 +09:00
Peter Zhu c6f84e9189 [Bug #19398] Memory leak in WeakMap
There's a memory leak in ObjectSpace::WeakMap due to not freeing
the `struct weakmap`. It can be seen in the following script:

```
100.times do
  10000.times do
    ObjectSpace::WeakMap.new
  end

  # Output the Resident Set Size (memory usage, in KB) of the current Ruby process
  puts `ps -o rss= -p #{$$}`
end
```
2023-02-01 13:23:55 -05:00
Hiroshi SHIBATA 375f527ded [rubygems/rubygems] Introduce to specify deprecated version for rubygems_deprecate_command.
We sometimes to remove minor command without bumping major version. This feature
  helps this deprecation process.

https://github.com/rubygems/rubygems/commit/41301cd2a8
2023-02-01 16:44:55 +00:00
Takashi Kokubun e11067ebbf
YJIT: Fix BorrowMutError on BOP invalidation (#7212) 2023-01-31 15:26:56 -05:00
Charles Oliver Nutter 29133794a3
[ruby/psych] Update for stricter 1.2 syntax
This allows these tests to pass on SnakeYAML Engine -- which is a
1.2-only YAML library -- while still passing on libyaml 1.1.

https://github.com/ruby/psych/commit/f44269fc9b
2023-01-31 13:14:05 +09:00
David Rodríguez 022acb9593 [rubygems/rubygems] Don't load Bundler from RubyGems tests
https://github.com/rubygems/rubygems/commit/c2e4cb7b5e
2023-01-31 10:49:08 +09:00
Nobuyoshi Nakada 3a7367ccc3 mkconfig: Map `includedir` only for system ruby
Only when installing to the system path on macOS, prepend '$(SDKROOT)'
and remap `includedir`.
Fix https://github.com/rbenv/ruby-build/discussions/2123
2023-01-31 06:33:16 +09:00
Takashi Kokubun 2e0f3b5546
YJIT: Fix BorrowMutError on GC.compact (#7176)
YJIT: Fix BorrowMutError
2023-01-30 11:16:33 -08:00
Mat Sadler b4defea362 [rubygems/rubygems] install rust extensions into expected directory nesting
https://github.com/rubygems/rubygems/commit/85ea86d348
2023-01-30 17:39:47 +00:00
Mat Sadler ca951f6719 [rubygems/rubygems] use cargo to get crate name
the final copying of the extension into place has been slimmed
down, reflecting that it only needs to copy a single file, rather
than replicating the more involved process used for a C ext

this also refactors #build so that #cargo_crate_name only needs
to be called once, and hopefully the build flow is easier to
understand

https://github.com/rubygems/rubygems/commit/5a0d7f2e6c
2023-01-30 17:39:47 +00:00
Mat Sadler 0c2b43462f [rubygems/rubygems] remove unused files in cargo builder test fixtures
https://github.com/rubygems/rubygems/commit/233847513b
2023-01-30 17:39:46 +00:00
Jeremy Evans eccfc978fd Fix parsing of regexps that toggle extended mode on/off inside regexp
This was broken in ec3542229b. That commit
didn't handle cases where extended mode was turned on/off inside the
regexp.  There are two ways to turn extended mode on/off:

```
/(?-x:#y)#z
/x =~ '#y'

/(?-x)#y(?x)#z
/x =~ '#y'
```

These can be nested inside the same regexp:

```
/(?-x:(?x)#x
(?-x)#y)#z
/x =~ '#y'
```

As you can probably imagine, this makes handling these regexps
somewhat complex. Due to the nesting inside portions of regexps,
the unassign_nonascii function needs to be recursive.  In
recursive mode, it needs to track both opening and closing
parentheses, similar to how it already tracked opening and
closing brackets for character classes.

When scanning the regexp and coming to `(?` not followed by `#`,
scan for options, and use `x` and `i` to determine whether to
turn on or off extended mode.  For `:`, indicting only the
current regexp section should have the extended mode
switched, recurse with the extended mode set or unset. For `)`,
indicating the remainder of the regexp (or current regexp portion
if already recursing) should turn extended mode on or off, just
change the extended mode flag and keep scanning.

While testing this, I noticed that `a`, `d`, and `u` are accepted
as options, in addition to `i`, `m`, and `x`, but I can't see
where those options are documented.  I'm not sure whether or not
handling  `a`, `d`, and `u` as options is a bug.

Fixes [Bug #19379]
2023-01-30 08:51:12 -08:00
Jean Boussier 3f54d09a5b bignum.c: rb_int_parse_cstr handle `0` strings
[Bug #19390]

We shouldn't check the string length when skipping zeros, as the
string might only contains zero characters, resulting in an empty string.
2023-01-30 14:42:40 +01:00
Hiroshi SHIBATA b432867429
Skip OpenSSL::TestHMAC#test_dup when running with RHEL9 2023-01-30 16:55:14 +09:00
Nobuyoshi Nakada 21dced8b01 [ruby/stringio] [Bug #19389] Fix chomping with longer separator
https://github.com/ruby/stringio/commit/eb322a9716
2023-01-28 13:00:08 +00:00
Benoit Daloze 47b66a5acd [ruby/bigdecimal] Add truffleruby in CI
https://github.com/ruby/bigdecimal/commit/5a25e26e08
2023-01-27 11:07:06 +00:00
Hiroshi SHIBATA 967dec5d61
[ruby/openssl] Added CoreAssertions
https://github.com/ruby/openssl/commit/520601e11d

  This commits swtich to use ruby/ruby's envutil.rb instead of
  vendored in openssl repo.
2023-01-27 11:30:13 +09:00
Andrew Konchin 5afc830130
[ruby/openssl] Do not require test file in a forked process in tests
https://github.com/ruby/openssl/commit/ae784673d7
2023-01-27 11:30:13 +09:00
Samuel Giddins 70829928cb [rubygems/rubygems] Deprecate Gem::List
It is unused, we will remove it in the next major version

https://github.com/rubygems/rubygems/commit/c3f6c27d6d
2023-01-26 21:41:48 +00:00
Nobuyoshi Nakada 5a73e131d7 Add tests for variables in `END` block shared with the toplevel 2023-01-24 16:36:33 +09:00
dependabot[bot] 98081ac7cc [rubygems/rubygems] Bump rb-sys
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.56 to 0.9.58.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.56...v0.9.58)

---
updated-dependencies:
- dependency-name: rb-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-24 01:35:42 +00:00
dependabot[bot] e23e8f4a6b [rubygems/rubygems] Bump rb-sys in /test/rubygems/test_gem_ext_cargo_builder/custom_name
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.56 to 0.9.58.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.56...v0.9.58)

---
updated-dependencies:
- dependency-name: rb-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-23 22:14:19 +00:00
Jean Boussier 8fded5f5d1 [ruby/psych] Fix RestrictedYAMLTree allowing the Symbol class should allow all symbols
Ref: https://github.com/ruby/psych/pull/495

That's how it works for `safe_load`:
```ruby
>> YAML.safe_load(':foo', permitted_classes: [Symbol])
=> :foo
```

So `safe_dump` should mirror that.

https://github.com/ruby/psych/commit/592a75a656
2023-01-23 02:07:23 +00:00
Kouhei Yanagita 20a85ab611
Fix Integer#ceildiv to respect #coerce (#7118)
Fixes [Bug #19343]
2023-01-22 18:53:02 +09:00
Samuel Williams f5ea43a2e6
More coverage tests & specs. (#7171)
* Add spec for eval and line coverage.

* Add test for main file coverage.
2023-01-22 13:49:13 +13:00
tompng 76e3d853ab [ruby/reline] Add autoindent test for indent after bracket and newline
https://github.com/ruby/reline/commit/3f3da7d0e2
2023-01-20 13:40:16 +00:00
Nobuyoshi Nakada 53cd5796c5 [rubygems/rubygems] Clean test output
The output from the command is mixed in this test, even when
successful.
Use the output as a part of the message on failure instead.

https://github.com/rubygems/rubygems/commit/960509a133
2023-01-20 10:39:57 +00:00
Shugo Maeda cce3960964 [Feature #19314] Add new arguments of String#bytesplice
bytesplice(index, length, str, str_index, str_length) -> string
  bytesplice(range, str, str_range) -> string

In these forms, the content of +self+ is replaced by str.byteslice(str_index, str_length) or str.byteslice(str_range); however the substring of +str+ is not allocated as a new string.
2023-01-20 18:02:37 +09:00
Peter Zhu 0949cd7107 [ci skip] Add ticket label to test 2023-01-19 16:26:32 -05:00
lukeg f66804e6f7 don't allow setting class variable on module that's frozen [Bug #19341] 2023-01-19 16:25:20 -05:00
Shugo Maeda f7b72462aa
String#bytesplice should return self
In Feature #19314, we concluded that the return value of String#bytesplice
should be changed from the source string to the receiver, because the source
string is useless and confusing when extra arguments are added.

This change should be included in Ruby 3.2.1.
2023-01-19 17:13:07 +09:00
Samuel Williams edd00697a8
Test some missing coverage too. (#7041) 2023-01-19 11:59:51 +13:00
tompng 976d72a9f5 [ruby/reline] Add scrollbar scroll-to-bottom test and fix existing scrollbar rendeing test
https://github.com/ruby/reline/commit/268e02b155
2023-01-18 14:49:28 +00:00
tomoya ishida 2d7e639549 [ruby/reline] multiline_repl do not need to depend on RubyLex
(https://github.com/ruby/reline/pull/502)

* multiline_repl do not need to depend on RubyLex

* Add auto indent test
2023-01-18 05:28:18 +00:00
Kaíque Kandy Koga 46066d0b96
Change ArgumentError message when Comparable#clamp receives min value higher than max value 2023-01-17 21:25:11 -08:00
dependabot[bot] 9399352a43 [rubygems/rubygems] Bump rb-sys in /test/rubygems/test_gem_ext_cargo_builder/custom_name
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.54 to 0.9.56.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.54...v0.9.56)

---
updated-dependencies:
- dependency-name: rb-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-17 09:57:05 +00:00
Peter Zhu ed6fbb79e1 Fix crash when defining ivars on special constants
[Bug #19339]
2023-01-17 04:51:15 -05:00
dependabot[bot] d7af0f6082 [rubygems/rubygems] Bump rb-sys
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.54 to 0.9.56.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.54...v0.9.56)

---
updated-dependencies:
- dependency-name: rb-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-17 07:19:03 +00:00
Nobuyoshi Nakada 71ce7e1825
[Bug #19335] `Integer#remainder` should respect `#coerce` (#7120)
Also `Numeric#remainder` should.
2023-01-15 13:03:27 +09:00
HASUMI Hitoshi 5b26f76ad9 [ruby/reline] Correspond to refactored RubyLex
(https://github.com/ruby/reline/pull/498)

* Correspond to refactored RubyLex

ref: https://github.com/ruby/irb/pull/503

* Fix test_yamatanooroti
2023-01-14 09:19:41 +00:00
Stan Lo cb9b885e78 [ruby/irb] Store context in RubyLex
Some background for this refactor:

1. Through a RubyLex instance's lifetime, the context passed to its methods
   should be the same.
   Given that `Context` is only initialised in `Irb#initialize`,
   this should be true.

2. When `RubyLex` is initialised, the context object should be accessible.
   This is also true in all 3 of `RubyLex.new`'s invocations.

With the above observations, we should be able to store the context in `RubyLex`
as an instance variable. And doing so will make `RubyLex`'s instance methods
easier to use and maintain.

https://github.com/ruby/irb/commit/5c8d3df2df
2023-01-14 09:19:09 +00:00
Matt Valentine-House bb5fddd070 Remove MIN_PRE_ALLOC_SIZE from Strings.
This optimisation is no longer helpful now that we use VWA to allocate
strings in larger size pools where they can be embedded.
2023-01-13 10:31:35 -05:00
Yusuke Endoh 94d6d6d93f [ruby/error_highlight] Identify which node in `Foo::Bar::Baz` causes a NameError
In Ruby 3.2 or later, a nested constant access like `Foo::Bar::Baz` is
compiled to one instruction by the optimization https://github.com/ruby/ruby/pull/6187

We try to spot which sub-node caues a NameError in question based on the
constant name. We will give up if the same constant name is accessed in
a nested access (`Foo::Foo`).

Fixes https://github.com/ruby/error_highlight/pull/31

https://github.com/ruby/error_highlight/commit/0a4db7da0a
2023-01-13 08:25:09 +00:00
Nobuyoshi Nakada 5b36fefc4e
Skip time-related assertions on /dev/null 2023-01-13 12:26:16 +09:00
Koichi Sasada 2e7bceb34e Do not use VM stack for splat arg on cfunc
On the cfunc methods, if a splat argument is given, all array elements
are expanded on the VM stack and it can cause SystemStackError.
The idea to avoid it is making a hidden array to contain all parameters
and use this array as an argv.

This patch is reviesed version of https://github.com/ruby/ruby/pull/6816
The main change is all changes are closed around calling cfunc logic.

Fixes [Bug #4040]

Co-authored-by: Jeremy Evans <code@jeremyevans.net>
2023-01-13 09:30:29 +09:00
Stan Lo 207f8d0027 [ruby/irb] Avoid calling private methods on the main object
(https://github.com/ruby/irb/pull/498)

When the main object is frozen, `IRB` wraps a `SimpleDelegator` around it.
But because `SimpleDelegator` doesn't delegate private methods, methods like
`require_relative` or `const_get` would cause error, which are needed for
lazily loading commands.

This commit works around this limitation by avoiding those private method calls
when setting up command execution.
2023-01-12 11:49:16 +00:00
Jean Boussier a8537eae2a [ruby/mutex_m] Avoid anonymous eval
It makes it hard to locate code when profiling etc.

https://github.com/ruby/mutex_m/commit/8760ab19ec
2023-01-12 05:41:59 +00:00
tomoya ishida 0abb4b6348 [ruby/reline] Pass unmodifined lines(that does not include escape
sequence) to check_multiline_prompt
(https://github.com/ruby/reline/pull/458)

* pass unmodified lines to check_multiline_prompt

* Add test to check that output modified by output_modifier_proc is not passed to prompt_proc
2023-01-12 00:14:53 +00:00
Jean Boussier bcdc058e50 [ruby/racc] Get rid of anonymous eval calls
Things declared in anonymous eval are always annoying to locate.
(profilers, etc)

https://github.com/ruby/racc/commit/f304205256
2023-01-12 07:52:29 +09:00
Masataka Pocke Kuwabara 11e15b4d48 [ruby/racc] Make racc Ractor compatible
https://github.com/ruby/racc/commit/1948de9d1d
2023-01-12 07:52:25 +09:00
Stan Lo c693dfd7ef [ruby/irb] Drop unused arguments in `RubyLex`
(https://github.com/ruby/irb/pull/504)

* Simplify `RubyLex#set_prompt`

It's optional argument is never used by any caller.

* Remove the optional `p` argument from `RubyLex#set_input`

The argument is only used in a test case, which can be easily replaced by
a block argument.
2023-01-11 21:26:18 +00:00
Benoit Daloze 6abe20e87b Remove Encoding#replicate 2023-01-11 13:41:41 +01:00
Phillip Hellewell d831b1d5ce [ruby/reline] Reset IOGate in test_reset
https://github.com/ruby/reline/commit/331c1094ef
2023-01-11 11:38:51 +00:00