Commit graph

18546 commits

Author SHA1 Message Date
Jun Aruga
674db715f5 [ruby/rdoc] test/rdoc/test_rdoc_generator_json_index.rb: Use assert_equal instead of assert.
It's better because assert_equal prints the values when it fails.

91d40ce8f8
2023-10-30 16:21:28 +00:00
Kevin Newton
7bf3d9343f [ruby/prism] parse_inline_comments -> parse_comments
bd4d248fd6
2023-10-30 15:53:37 +00:00
Kevin Newton
9d1472496d [ruby/prism] Remove newlines from magic comment test
4a7be1fc50
2023-10-30 15:08:24 +00:00
Christian van Rensen
f109269a03 [ruby/net-http] fix a false-negative test
* no_proxy is meant to operate on the destination address, not on the name of the proxy
* if both end with `'.example'`, the test does not nail down the behaviour

bb9a5cfa3d
2023-10-30 09:27:06 +00:00
Hiroya Fujinami
34cb174800
Optimize regexp matching for look-around and atomic groups (#7931) 2023-10-30 13:10:42 +09:00
Nobuyoshi Nakada
a447a6d1a9
Extract transcoding assertions
- Prefix `check_both_ways` with `assert_` to show proper failure
  lines.

- Extract dedicated assertions for Encoding::UndefinedConversionError
  and Encoding::InvalidByteSequenceError.
2023-10-28 22:18:17 +09:00
Jun Aruga
3eaae72855
test/fiber/test_queue.rb: Make the stuck test fail. (#8791)
test/fiber/test_queue.rb: Make the stuck tests fail.

We observed the 2 tests in the `test/fiber/test_queue.rb` getting stuck
in some GCC compilers in Ubuntu ppc64le focal/jammy, even when the timeout
`queue.pop(timeout: 0.0001)` is set in the code.

This commit is to make the tests fail rather than getting stuck.
2023-10-28 11:10:30 +02:00
Jean Boussier
4aee6931c3 Make get_next_shape_internal idempotent
Since the check for MAX_SHAPE_ID was done before even checking
if the transition we're looking for even exists, as soon as the
max shape is reached, get_next_shape_internal would always return
`TOO_COMPLEX` regardless of whether the transition we're looking
for already exist or not.

In addition to entirely de-optimize all newly created objects, it
also made an assertion fail in `vm_setivar`:

```
vm_setivar:rb_shape_get_next_iv_shape(rb_shape_get_shape_by_id(source_shape_id), id) == dest_shape
```
2023-10-27 21:09:03 +02:00
Peter Zhu
d654d580f3 Revert "Add debug info for flaky test_warmup_frees_pages"
This reverts commit db3b814cb0.

This debugging information is no longer needed.
2023-10-27 14:28:56 -04:00
Kevin Newton
c201dbc0ad [ruby/prism] Prism.parse_inline_comments
5b72f84480
2023-10-27 18:09:14 +00:00
Kevin Newton
df10e10314 [ruby/prism] Parse inline comments
44090d9f26
2023-10-27 18:09:14 +00:00
Kevin Newton
a8af5d3808 [ruby/prism] Use MatchWriteNode on split InterpolatedREN
ee54244800
2023-10-27 13:40:25 +00:00
Kevin Newton
a40e2b8ee9 [ruby/prism] Fix parsing lone assoc splat within hash patterns
1da5e05672
2023-10-27 02:09:33 +00:00
Lars Kanis
9a618b95cd
[Feature #19244] Windows: Prefer USERPROFILE over HOMEPATH on startup as well 2023-10-27 10:16:18 +09:00
Kevin Newton
f3e77f36c5 [ruby/prism] Fix up newline test
9fdb41d8ba
2023-10-26 19:40:21 +00:00
Kevin Newton
21dc64534b [ruby/prism] Regenerate snapshots
160df9a687
2023-10-26 15:19:52 -04:00
Kevin Newton
018f0a9c5f [ruby/prism] Rename to lefts/rights
e6deed05a5
2023-10-26 14:59:13 -04:00
Kevin Newton
922f48f081 [ruby/prism] Remove RequiredDestructuredParameterNode in favor of MultiTargetNode
6d1858192e
2023-10-26 14:59:07 -04:00
Kevin Newton
533bd1d1fa [ruby/prism] Ensure no extra multi-target nodes are created for splats
e60240d54b
2023-10-26 14:59:00 -04:00
Kevin Newton
82acca915a [ruby/prism] Ensure no extra multi-target nodes are created
ec31fd827f
2023-10-26 14:58:55 -04:00
Kevin Newton
234e8fb819 [ruby/prism] Split up multi target/write targets
dda7a0da52
2023-10-26 14:58:48 -04:00
Jemma Issroff
7e4ee92de2 [ruby/prism] Add KeywordSplat flag to ArgumentsNode
Method calls with keyword splat args compile differently than
without since they merge the keyword arg hash with the keyword splat
hash. We know this information at parse time, so can set a flag
which the compiler can use.

e5f8a9a3cd
2023-10-26 18:47:50 +00:00
eileencodes
a082e560bb [PRISM] Implement regex encoding flags
Added the  correct encoding to the allocated regex. This required making
a new method to set the encoding and pass that to `rb_enc_reg_new`
instead of `rb_reg_new`. The former `rb_reg_new` would set the encoding
to ASCII8BIT regardless of encoding flag.
2023-10-26 11:11:52 -07:00
lukeg
b57b7acc20 add more shapes tests 2023-10-26 13:07:12 -03:00
HParker
8f4a8cd05b teach prism define to compile basic types 2023-10-26 11:54:26 -03:00
Jemma Issroff
9570a88bb3 [PRISM] Implement compilation for ConstantPathAndWriteNode 2023-10-26 11:42:15 -03:00
Jemma Issroff
ec2878c11b [PRISM] Implement compilation for ConstantPathOrWriteNode 2023-10-26 11:42:15 -03:00
Jemma Issroff
b5f61750b9 [PRISM] Implemented ConstantPathOperatorWriteNode 2023-10-26 11:42:15 -03:00
Jemma Issroff
bfb9b5e699 [PRISM] Implement compilation for CaseNode 2023-10-26 08:45:43 -03:00
Jemma Issroff
7b6b17a92b [PRISM] Rename new tests to use assert_prism_eval 2023-10-26 07:15:35 -03:00
Jemma Issroff
d6cb2dc622 [PRISM] Refactor tests to deconflict with existing tests 2023-10-26 07:15:35 -03:00
Jemma Issroff
8e5744588f [PRISM] Implement CallOperatorWriteNode 2023-10-26 07:15:35 -03:00
Jemma Issroff
68a81b44e3 [PRISM] Implement compilation for CallOrWriteNode 2023-10-26 07:15:35 -03:00
Jemma Issroff
2a8dbb1323 [PRISM] Implemented compilation for CallAndWriteNode 2023-10-26 07:15:35 -03:00
Yusuke Endoh
701ca070b4 Prevent a warning: assigned but unused variable - z 2023-10-26 14:30:17 +09:00
Hiroshi SHIBATA
ab9659620f
Revert "[ruby/prism] Use cargo fmt"
This reverts commit 4259d5b5ae.

  This commits is wrong result of sync_default_gems.rb
2023-10-26 18:03:58 +09:00
Nobuyoshi Nakada
1507118f0b [Feature #19362] Call #initialize_dup hook at Proc#dup 2023-10-26 17:28:50 +09:00
Nobuyoshi Nakada
c8d162c889
[Bug #19973] Warn duplicated keyword arguments after keyword splat 2023-10-26 14:28:39 +09:00
fn ⌃ ⌥
3ef7b632a0 Make beginless Range#size return nil if it ends with non-numeric 2023-10-26 10:56:47 +09:00
Ian Ker-Seymer
4259d5b5ae [ruby/prism] Use cargo fmt
5969b827ae
2023-10-26 01:18:43 +00:00
HParker
0a3eba0bf7 Fix few test_prism_eval that snuck in 2023-10-25 12:51:20 -07:00
Samuel Giddins
3fe2f2689f [rubygems/rubygems] Raise exception on unexpected EOF in marshal
Instead of NoMethodError being raised by accidentally trying to use nil

ac8f812bbf
2023-10-25 18:52:38 +00:00
eileencodes
b0a9707364 Use assert_prism_eval over test_prism_eval in helper
When we use `test_prism_eval`, failed tests will point to the line
number of the `test_prism_eval` method definition instead of the test
that failed. If we use `assert_prism_eval` instead, failed tests will
properly poin to the test that failed because the test framework knows
to stop the backtrace earlier.

Before line number in failure points to helper definition:

```
Prism::TestCompilePrism#test_RegularExpressionNode = 0.21 s
  1) Failure:
Prism::TestCompilePrism#test_RegularExpressionNode [test/ruby/test_compile_prism.rb:755]:
</pit/> (Windows-31J) expected but was
</pit/> (US-ASCII).
```

After line number in failure points to test that failed:

```
Prism::TestCompilePrism#test_RegularExpressionNode = 0.00 s
  1) Failure:
Prism::TestCompilePrism#test_RegularExpressionNode [test/ruby/test_compile_prism.rb:334]:
</pit/> (Windows-31J) expected but was
</pit/> (US-ASCII).
```
2023-10-25 11:00:13 -07:00
Jemma Issroff
fb0a30166d [PRISM] Add tests for ParametersNode 2023-10-25 13:02:44 -03:00
Jemma Issroff
fe0827013b [PRISM] Implement NoKeywordsParameterNode 2023-10-25 13:02:44 -03:00
Yusuke Endoh
f26d53e905 Reduce the number of times IO is passed in send_io/recv_io test
Since Linux 4.5, sendmsg(2) fails with ETOOMANYREFS if the number of
"in-flight" IOs, which has been sent by sendmsg(2) but has not yet
accepted by recvmsg(2), exceeds the RLIMIT_NOFILE resource limit.

20231025T090004Z.fail.html.gz
```
  1) Error:
TestSocket_UNIXSocket#test_fd_passing_race_condition:
Errno::ETOOMANYREFS: Too many references: cannot splice - sendmsg(2)
```

This change reduces the number of times of IO passing under 1024,
which is a default limit in many environments.
2023-10-25 20:37:21 +09:00
Nobuyoshi Nakada
54a5623e26
Strip trailing spaces [ci skip] 2023-10-25 18:58:52 +09:00
Hiroshi SHIBATA
1649486834
Fixup 5461bc18f8 2023-10-25 18:49:37 +09:00
Hiroshi SHIBATA
5461bc18f8
omit failing test at arm64-neoverse-n1 2023-10-25 16:47:26 +09:00
Kouhei Yanagita
593de2b048 Add tests for passing nil to Comparable#clamp(min, max) 2023-10-25 16:34:48 +09:00