Commit graph

16692 commits

Author SHA1 Message Date
TSUYUSATO Kitsune
71c76d1bfa Update timeout seconds 2022-11-09 23:21:26 +09:00
TSUYUSATO Kitsune
80d145fa52 Fix and add regexp tests 2022-11-09 23:21:26 +09:00
Yusuke Endoh
c3de7a3c58 Make pending_interrupt?(Exception) work
A patch from katsu (Katsuhiro Ueno)

[Bug #19110]
2022-11-09 12:25:35 +09:00
Stan Lo
b7b78f062f [ruby/irb] Add execute_lines to reduce command tests' boilerplate
code
(https://github.com/ruby/irb/pull/436)

1595337149
2022-11-08 17:19:59 +00:00
Jean byroot Boussier
eacedcfe44
mutex: Raise a ThreadError when detecting a fiber deadlock (#6680)
[Bug #19105]

If no fiber scheduler is registered and the fiber that
owns the lock and the one that try to acquire it
both belong to the same thread, we're in a deadlock case.

Co-authored-by: Jean Boussier <byroot@ruby-lang.org>
2022-11-09 00:43:16 +13:00
Yusuke Endoh
4a7d6c2852 Fix false LocalJumpError when branch coverage is enabled
`throw TAG_BREAK` instruction makes a jump only if the continuation of
catch of TAG_BREAK exactly matches the instruction immediately following
the "send" instruction that is currently being executed. Otherwise, it
seems to determine break from proc-closure.

Branch coverage may insert some recording instructions after "send"
instruction, which broke the conditions for TAG_BREAK to work properly.

This change forces to set the continuation of catch of TAG_BREAK
immediately after "send" (or "invokesuper") instruction.

[Bug #18991]
2022-11-08 14:37:08 +09:00
Takashi Kokubun
9001e53e68 [ruby/irb] Support non-string input in show_source
(https://github.com/ruby/irb/pull/430)

* Support non-string input in show_source

* Test show_source as a method
2022-11-07 17:29:28 +00:00
Yusuke Endoh
72c7dba436 [ruby/fileutils] Revert "FileUtils.rm* methods swallows only Errno::ENOENT when force is true"
This reverts commit fa65d676ec.

This caused some incompatibility problems in real-world cases.
https://bugs.ruby-lang.org/issues/18784#change-98927
https://bugs.ruby-lang.org/issues/18784#change-98967

42983c2553
2022-11-07 11:25:25 +00:00
Peter Zhu
33bc398b73 [rubygems/rubygems] Fix rubocop violations
cc12e68637
2022-11-07 10:52:15 +00:00
Peter Zhu
0fb7a1c77c [rubygems/rubygems] Drop support for HP-UX
Support for HP-UX was dropped in Ruby in ruby/ruby#5457.

a3a8df3582
2022-11-07 10:52:13 +00:00
Nobuyoshi Nakada
011d4c57d2
[Bug #19106] Normalize time at 24:00:00 with a timezone object 2022-11-07 15:56:12 +09:00
Stan Lo
367c072ac6 [ruby/irb] Silent the noise created when building Context in tests
27e4274b3c
2022-11-04 18:29:54 +00:00
Nobuyoshi Nakada
b83074dac7 [ruby/irb] Suppress "switching inspect mode" messages
ee068d039b
2022-11-04 11:43:21 +00:00
Takashi Kokubun
dc5d06e9b1 [ruby/erb] Copy CGI.escapeHTML to ERB::Util.html_escape
ac9b219fa9
2022-11-04 07:07:23 +00:00
Stan Lo
a923203811 [ruby/irb] Provide a base test class and let tests restore encodings
conveniently
(https://github.com/ruby/irb/pull/429)

* Create a base TestIRB::TestCase class

* Save/restore encodings for tests that initializes InputMethod classes

Because `RelineInputMethod#initializes` calls `set_encoding`, which
changes stdio/out/err and Encoding's default encoding values, we need to
make sure any test that directly or indirectly (e.g. through Context)
initializes `RelineInputMethod` restores encodings.

`ReadlineInputMethod` also changes encodings but currently no tests
cover it.

* Remove unnecessary TestHelper module

Since we now have a base TestCase, without_rdoc can just live there.

c2874ec121
2022-11-03 22:13:11 +00:00
Takashi Kokubun
a13836e70d [ruby/irb] Allow non-identifier aliases like Pry's @ and $
(https://github.com/ruby/irb/pull/426)

* Allow non-identifier aliases

* Move the configuration to IRB.conf

* Avoid abusing method lookup for symbol aliases

* Add more alias tests

* A small optimization

* Assume non-nil Context

* Load IRB.conf earlier

e23db5132e
2022-11-03 22:09:55 +00:00
Takashi Kokubun
56884b64de [ruby/irb] Require rubygems to run the test alone on ruby/ruby
`Gem` is not undefined on test-all

08ac803d61
2022-11-03 17:42:45 +00:00
Takashi Kokubun
ea77aa2fd0
YJIT: Make Code GC metrics available for non-stats builds (#6665) 2022-11-03 13:41:35 -04:00
Takashi Kokubun
611b5e7f40 [ruby/irb] Fix build_context for ruby/ruby CI
Co-Authored-By: Stan Lo <stan.lo@shopify.com>

d1fe234a9a
2022-11-03 17:35:15 +00:00
Stan Lo
00f559641a [ruby/irb] Require the entire irb lib in RubyLex test
(https://github.com/ruby/irb/pull/428)

RubyLex is not designed to be used alone. It's usually used with an IRB
context, which requires workspace. So its tests should have access to
those components too.

608f261da4
2022-11-03 17:12:35 +00:00
Stan Lo
c5d6a483f5 [ruby/irb] Refactor RubyLex and its tests
(https://github.com/ruby/irb/pull/427)

* Make sure `RubyLex#set_input`'s context is always present in tests

In real-world scenarios, the context should always be non-nil:
https://github.com/ruby/irb/blob/master/lib/irb.rb#L489

So we should make sure our test setup reflects that.

* Make context a required keyword

Since in practice, `set_input`'s context should always be non-nil, its
parameters should reflect that.

And since `RubyLex#check_state` is only called by `#lex` and
`#set_input`, both of which now always require context, we can assume
its context should be non-nil too.

1aeeb86203
2022-11-03 16:32:22 +00:00
Takashi Kokubun
7b6c5f9b5b [ruby/erb] Skip a test for JRuby
48a75665ab
2022-11-03 05:58:14 +00:00
Takashi Kokubun
f667d3afc9 [ruby/erb] Skip tests for truffleruby
65a7c70a00
2022-11-03 05:58:14 +00:00
dependabot[bot]
875b7b3361 [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.34 to 0.9.35.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.34...v0.9.35)

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

Signed-off-by: dependabot[bot] <support@github.com>

19feb314cb
2022-11-02 10:31:18 +00:00
Samuel Williams
16953867ed
We don't care about actual hostname resolution. (#6652)
https://bugs.ruby-lang.org/issues/18380
2022-11-01 17:10:31 +13:00
dependabot[bot]
4c59808a46 [rubygems/rubygems] Bump rb-sys
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.34 to 0.9.35.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.34...v0.9.35)

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

Signed-off-by: dependabot[bot] <support@github.com>

73268e7af5
2022-11-01 00:10:52 +00:00
Takashi Kokubun
2b39640b0b
YJIT: Add RubyVM::YJIT.code_gc (#6644)
* YJIT: Add RubyVM::YJIT.code_gc

* Rename compiled_page_count to live_page_count
2022-10-31 14:29:45 -04:00
eileencodes
350d0aa023 [ruby/error_highlight] Support nodes in spot
Fixes a bug where `spot` was using the wrong local variable.

We want to use error highlight with code that has been eval'd,
specifically ERB templates. We can recover the compiled source code of
the ERB template but we need an API to pass the node into error
highlight's `spot`.

Required Ruby PR: https://github.com/ruby/ruby/pull/6593

0b1b650a59

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2022-10-31 04:58:38 +00:00
eileencodes
3391c51eff Add node_id_for_backtrace_location function
We want to use error highlight with eval'd code, specifically ERB
templates. We're able to recover the generated code for eval'd templates
and can get a parse tree for the ERB generated code, but we don't have a
way to get the node id from the backtrace location. So we can't pass the
right node into error highlight.

This patch gives us an API to get the node id from the backtrace
location so we can find the node in the AST.

Error Highlight PR: https://github.com/ruby/error_highlight/pull/26

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2022-10-31 13:39:56 +09:00
Nobuyoshi Nakada
d5fb76a6c8 [ruby/optparse] Add tests for load(into:)
51f7e060ee
2022-10-29 13:47:23 +00:00
Nobuyoshi Nakada
4dac53f0a4 [ruby/optparse] Add tests for OptionParser#load
fb34a1d3a3
2022-10-29 13:40:19 +00:00
Nobuyoshi Nakada
4021c6565f [ruby/irb] Do not make non-existent XDG directory on start
(https://github.com/ruby/irb/pull/357)


298b134792
2022-10-28 09:36:28 +00:00
Nobuyoshi Nakada
56c97a6621 [ruby/irb] Update regarding NO_COLOR value
https://no-color.org has been updated (jcs/no_color#83):

> Command-line software which adds ANSI color to its output by default
should check for a `NO_COLOR` environment variable that, when present
and **not an empty string** (regardless of its value), prevents the
addition of ANSI color.

46e0f7e370

Co-authored-by: Stan Lo <stan001212@gmail.com>
2022-10-28 09:30:24 +00:00
Nobuyoshi Nakada
13e968c1cd [ruby/irb] Suppress sequence to inspect asian ambiguous width
a7097c5b80
2022-10-28 08:29:38 +00:00
Nobuyoshi Nakada
7440fc3eb4 [ruby/irb] Suppress "switching inspect mode" messages
565eeb3c19
2022-10-28 08:29:37 +00:00
Peter Zhu
ea5972572b [ruby/irb] Fix warnings in test_cmd.rb
Fixes this warning:

    warning: assigned but unused variable - err

298fcb57a3
2022-10-27 15:29:52 -04:00
Stan Lo
b260c1e8c8 [ruby/irb] Remove unnecessary test setup 2022-10-27 15:29:11 -04:00
Benoit Daloze
bb7067cbdf [ruby/irb] Suppress warning for test which uses a locale non-existing on GitHub Actions 2022-10-27 19:16:52 +00:00
Benoit Daloze
8d7844235c [ruby/irb] Remove unecesary and harmful pend for TruffleRuby in TestRaiseNoBacktraceException
* Specifically the second one causes `$HOME` to be unset, which breaks `File.expand_path('~')`.

61963305f5
2022-10-27 19:16:51 +00:00
Stan Lo
7cf7e6c332 [ruby/irb] Add missing require 2022-10-27 15:36:18 +00:00
st0012
26b913c88b [ruby/irb] Add test for IRB::InputCompletor::PerfectMatchedProc
This proc displays rdoc document when the input matches certain symbols
perfectly, like "String". It's commonly triggered with autocompletion
but only has 1 test case. So this commit increases its test coverage.

d85d719313
2022-10-27 15:25:39 +00:00
Nobuyoshi Nakada
cb80ee7a4a [ruby/tmpdir] Warnings should contain the environment variable name 2022-10-27 03:12:00 +00:00
Matthew Draper
c746f380f2
YJIT: Support nil and blockparamproxy as blockarg in send (#6492)
Co-authored-by: John Hawthorn <john@hawthorn.email>

Co-authored-by: John Hawthorn <john@hawthorn.email>
2022-10-26 15:27:59 -04:00
Stan Lo
0dc2e1a764 [ruby/irb] Remove unnecessary warning check on help command
It's not an intentional behavior of the command and it behaves
differently in different environments. So checking it actually brings
more problem than benefit.

b3203bc784
2022-10-26 15:15:30 +00:00
Peter Zhu
73a0223f95 [ruby/irb] Rename test_helper.rb to helper.rb
The name test_helper.rb conflicts with the test_helper.rb in JSON,
causing build failures. This commit renames test_helper.rb to helper.rb.

b6a92bf6b3

Co-Authored-By: Stan Lo <stan001212@gmail.com>
2022-10-26 15:13:44 +00:00
st0012
cb95d834cc [ruby/irb] Don't insert new methods to Test::Unit::TestCase
Ruby CI runs irb and other Ruby core/stdlib tests in the same process.
So adding irb-specific helper to Test::Unit::TestCase could potentially
pollute other components' tests and should be avoided.
2022-10-26 10:44:29 -04:00
Stan Lo
2022470a95 [ruby/irb] Suppress warnings
Co-authored-by: Peter Zhu <peter@peterzhu.ca>
2022-10-26 10:44:26 -04:00
st0012
d889e810f3 [ruby/irb] Add test for the help command 2022-10-26 10:44:23 -04:00
st0012
40f8a781a3 [ruby/irb] Extract without_rdoc helper 2022-10-26 10:44:03 -04:00
Stan Lo
48339d5c5b [ruby/irb] Make sure Encoding's defaults are restored 2022-10-25 20:50:07 +00:00