summaryrefslogtreecommitdiff
path: root/test/ruby
AgeCommit message (Collapse)Author
2025-02-28Improve tests for small UTF regex with case fold.Maciek Rząsa
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/12787
2025-02-28Use mbuf instead of bitset for character class for small UTF. Fixes #16145Maciej Rzasa
Notes: Merged: https://github.com/ruby/ruby/pull/12787
2025-02-27[Bug #21159] module names should not be modifiableNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/12819
2025-02-24[Bug #21153] Add missing op-assign to top const in `command_asgn`Nobuyoshi Nakada
It was defined in `arg` only; moved that pattern to `op_asgn` rule to share it with `command_asgn`.
2025-02-18Ensure IO.copy_stream buffer is an independent stringJeremy Evans
Otherwise, changes to the buffer by the destination write method could result in data changing for supposedly independent strings. Fixes [Bug #21131] Notes: Merged: https://github.com/ruby/ruby/pull/12771
2025-02-18Fix typo in test_gc_compact.rb [ci skip]Peter Zhu
2025-02-18Fix crash for special constants in too complex generic ivarsPeter Zhu
We should skip reference updating for entries in too complex generic ivars that are special constants. This fixes the following crash: MAX_SHAPES = 0x80000 MAX_SHAPES.times do |i| o = [] o.instance_variable_set(:"@foo#{i}", 1) end o = [] o.instance_variable_set(:"@a", 123) GC.compact Notes: Merged: https://github.com/ruby/ruby/pull/12781
2025-02-18Add a test for Binding#local_variable* with numbered parameters and `it`Yusuke Endoh
Notes: Merged: https://github.com/ruby/ruby/pull/12746
2025-02-14Only count VM instructions in YJIT stats buildsAaron Patterson
The instruction counter is slowing multi-Ractor applications. I had changed it to use a thread local, but using a thread local is slowing single threaded applications. This commit only enables the instruction counter in YJIT stats builds until we can figure out a way to gather the information with lower overhead. Co-authored-by: Randy Stauner <randy.stauner@shopify.com> Notes: Merged: https://github.com/ruby/ruby/pull/12670
2025-02-14[Bug #21127] Thread deadlock does not display backtraces (#12721)Masataka Pocke Kuwabara
Previously, Ruby displayed backtraces for each thread on deadlock. However, it has not been shown since Ruby 3.0. It should display the backtrace for debugging. Co-authored-by: Jeremy Evans <code@jeremyevans.net> Notes: Merged-By: pocke <p.ck.t22@gmail.com>
2025-02-13[Feature #21116] Extract RJIT as a third-party gemNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/12740
2025-02-13Extend timeout with resolv.rb and Windows platform. It's expired with 10sec ↵Hiroshi SHIBATA
sometimes.
2025-02-06Enable bundled gems in ruby-runnerNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/12706
2025-02-03Add out of range tests of random number generatorNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/12690
2025-02-01[Bug #21103] Fix local variable index calculation with forwardingNobuyoshi Nakada
Forwarding argument is optimized not to packed when no other arguments and an internal object refers values before it. This size is decided at called time, calculate the local variable index from the fixed end point. Notes: Merged: https://github.com/ruby/ruby/pull/12686
2025-01-31[Feature #19521] Test for `Module#set_temporary_name`Nobuyoshi Nakada
2025-01-31rb_alias: improve "undefined method" error message by invokingFabio Sangiovanni
`rb_print_undef` with `target_klass` as argument. Notes: Merged: https://github.com/ruby/ruby/pull/12665
2025-01-24Fix "Relax expectations of errors from `getgrnam`"Nobuyoshi Nakada
Use `assert_raise_kind_of` instead of `assert_raise`, that rejects sub classes of the given exceptions. Notes: Merged: https://github.com/ruby/ruby/pull/12626
2025-01-22Relax expectations of errors from `getgrnam`Nobuyoshi Nakada
The list of errors cited in 58bc97628c14933b73f13e0856d1a56e70e8b0e4 is not exhaustive and other errors may be raised by `getgrnam`. Additionally, these errors are system dependent and may not be listed on all platforms. Notes: Merged: https://github.com/ruby/ruby/pull/12610
2025-01-15Fix ENV tests on Windows on ARM64Lars Kanis
Due to the x64 emulation of Windows 11 on ARM the environment variable PROCESSOR_ARCHITECTURE is set by the process startup code. It must therefore be excluded from tests. Otherwise tests fail like so: ``` [30585/32394] TestProcess#test_execopts_unsetenv_others = 0.10 s 16) Failure: TestProcess#test_execopts_unsetenv_others [C:/Users/Lars/ruby/test/ruby/test_process.rb:446]: <""> expected but was <"PROCESSOR_ARCHITECTURE=ARM64\n">. [30616/32394] TestProcess#test_execopts_env = 0.16 s 17) Failure: TestProcess#test_execopts_env [C:/Users/Lars/ruby/test/ruby/test_process.rb:326]: <"PATH\n"> expected but was <"PATH\n" + "PROCESSOR_ARCHITECTURE\n">. ``` Notes: Merged: https://github.com/ruby/ruby/pull/12581
2025-01-14[PRISM] Handle forwarding inside evalKevin Newton
Fixes [Bug #21031] Notes: Merged: https://github.com/ruby/ruby/pull/12575
2025-01-14Add tests for Proc#parameters on `it` blocksAlan Wu
[Bug #20955]
2025-01-13Proc#parameters: Show anonymous optionals as `[:opt]`Alan Wu
Have this for lead parameters as well as parameters after rest ("post"). [Bug #20974] Notes: Merged: https://github.com/ruby/ruby/pull/12547
2025-01-13[Bug #21030] Fix step for non-numeric rangeNobuyoshi Nakada
When the end points of an inclusive range equal, `Range#step` should yields the element once. Notes: Merged: https://github.com/ruby/ruby/pull/12559
2025-01-12[Bug #21018] Fix for s390xNobuyoshi Nakada
2025-01-09[Feature #6012] Extend `source_location` for end position and columnsNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/12539
2025-01-09[Bug #21018] Show invalid command line option more properlyNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/12538
2025-01-09Implement FOR NODE locationsydah
The following Location information has been added This is the information required for parse.y to be a universal parser: ``` ❯ ruby --parser=prism --dump=parsetree -e "for a in b do end" @ ProgramNode (location: (1,0)-(1,17)) +-- locals: [:a] +-- statements: @ StatementsNode (location: (1,0)-(1,17)) +-- body: (length: 1) +-- @ ForNode (location: (1,0)-(1,17)) +-- index: | @ LocalVariableTargetNode (location: (1,4)-(1,5)) | +-- name: :a | +-- depth: 0 +-- collection: | @ CallNode (location: (1,9)-(1,10)) | +-- CallNodeFlags: variable_call, ignore_visibility | +-- receiver: nil | +-- call_operator_loc: nil | +-- name: :b | +-- message_loc: (1,9)-(1,10) = "b" | +-- opening_loc: nil | +-- arguments: nil | +-- closing_loc: nil | +-- block: nil +-- statements: nil +-- for_keyword_loc: (1,0)-(1,3) = "for" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +-- in_keyword_loc: (1,6)-(1,8) = "in" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +-- do_keyword_loc: (1,11)-(1,13) = "do" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +-- end_keyword_loc: (1,14)-(1,17) = "end" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ```
2025-01-08Avoid opt_aset_with optimization inside multiple assignmentJeremy Evans
Previously, since the opt_aset_with optimization was introduced, use of the opt_aset_with optimization inside multiple assignment would result in a segfault or incorrect instructions. Fixes [Bug #21012] Co-authored-by: Nobuyoshi Nakada <nobu.nakada@gmail.com> Notes: Merged: https://github.com/ruby/ruby/pull/12528 Merged-By: jeremyevans <code@jeremyevans.net>
2025-01-08Use erb instead of ostruct for test_frozen_loaded_featuresHiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/12531
2025-01-08[Bug #21011] `nd_value` is NULL in massignNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/12530
2025-01-07Correctly set node_id on iseq locationAaron Patterson
The iseq location object has a slot for node ids. parse.y was correctly populating that field but Prism was not. This commit populates the field with the ast node id for that iseq [Bug #21014] Notes: Merged: https://github.com/ruby/ruby/pull/12527
2025-01-07[Bug #21008] Normalize before sum to floatNobuyoshi Nakada
After switching to `Float`-mode when summing `Numeric` objects, normalization for `Float` is still needed. Notes: Merged: https://github.com/ruby/ruby/pull/12522
2025-01-07[Bug #21006] Fix defined_expr compilation of method call with parenth… ↵tomoya ishida
(#12518) [Bug #21006] Fix defined_expr compilation of method call with parenthesized receiver
2025-01-06Allow escaping from ensures through nextKevin Newton
Fixes [Bug #21001] Notes: Merged: https://github.com/ruby/ruby/pull/12513
2025-01-05Do not warn unused block when using forwardingKevin Newton
Fixes [Bug #21003] Notes: Merged: https://github.com/ruby/ruby/pull/12512
2025-01-04Suppress warnings for flip-flop in test_ast.rbPeter Zhu
There are warnings emitted from test_flip2_locations and test_flip3_locations. This commit changes ast_parse to suppress all warnings. warning: integer literal in flip-flop warning: string literal in flip-flop Notes: Merged: https://github.com/ruby/ruby/pull/12509
2025-01-04YJIT: Fix crash when yielding keyword argumentsAlan Wu
Previously, the code for dropping surplus arguments when yielding into blocks erroneously attempted to drop keyword arguments when there is in fact no surplus arguments. Fix the condition and test that supplying the exact number of keyword arguments as require compiles without fallback. Notes: Merged: https://github.com/ruby/ruby/pull/12499
2025-01-04Implement FLIP3 NODE locationsydah
Notes: Merged: https://github.com/ruby/ruby/pull/11986
2025-01-04Implement FLIP2 NODE locationsydah
Notes: Merged: https://github.com/ruby/ruby/pull/11986
2025-01-04Implement DOT3 NODE locationsydah
Notes: Merged: https://github.com/ruby/ruby/pull/11986
2025-01-04Implement DOT2 NODE locationsydah
Notes: Merged: https://github.com/ruby/ruby/pull/11986
2025-01-04Implement REGX NODE locationsydah
The following Location information has been added This is the information required for parse.y to be a universal parser: ``` ❯ ruby --parser=prism --dump=parsetree -e '/foo/' @ ProgramNode (location: (1,0)-(1,5)) +-- locals: [] +-- statements: @ StatementsNode (location: (1,0)-(1,5)) +-- body: (length: 1) +-- @ RegularExpressionNode (location: (1,0)-(1,5)) +-- RegularExpressionFlags: forced_us_ascii_encoding +-- opening_loc: (1,0)-(1,1) = "/" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +-- content_loc: (1,1)-(1,4) = "foo" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +-- closing_loc: (1,4)-(1,5) = "/" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +-- unescaped: "foo" ```
2025-01-04Implement LAMBDA NODE locationsydah
The following Location information has been added This is the information required for parse.y to be a universal parser: ``` ❯ ruby --parser=prism --dump=parsetree -e "-> (a, b) do foo end" @ ProgramNode (location: (1,0)-(1,20)) +-- locals: [] +-- statements: @ StatementsNode (location: (1,0)-(1,20)) +-- body: (length: 1) +-- @ LambdaNode (location: (1,0)-(1,20)) +-- locals: [:a, :b] +-- operator_loc: (1,0)-(1,2) = "->" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +-- opening_loc: (1,10)-(1,12) = "do" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +-- closing_loc: (1,17)-(1,20) = "end" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ : (snip) ```
2025-01-04Implement YIELD NODE locationsydah
The following Location information has been added This is the information required for parse.y to be a universal parser: ``` ❯ ruby --parser=prism --dump=parsetree -e 'def foo; yield end' @ ProgramNode (location: (1,0)-(1,18)) +-- locals: [] +-- statements: @ StatementsNode (location: (1,0)-(1,18)) +-- body: (length: 1) +-- @ DefNode (location: (1,0)-(1,18)) +-- name: :foo +-- name_loc: (1,4)-(1,7) = "foo" +-- receiver: nil +-- parameters: nil +-- body: | @ StatementsNode (location: (1,9)-(1,14)) | +-- body: (length: 1) | +-- @ YieldNode (location: (1,9)-(1,14)) | +-- keyword_loc: (1,9)-(1,14) = "yield" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | +-- lparen_loc: nil ^^^^^^^^^^^^^^^^^^^ | +-- arguments: nil | +-- rparen_loc: nil ^^^^^^^^^^^^^^^^^^^ +-- locals: [] +-- def_keyword_loc: (1,0)-(1,3) = "def" +-- operator_loc: nil +-- lparen_loc: nil +-- rparen_loc: nil +-- equal_loc: nil +-- end_keyword_loc: (1,15)-(1,18) = "end" ```
2025-01-04Implement EVSTR NODE locationsydah
The following Location information has been added This is the information required for parse.y to be a universal parser: ``` ❯ ruby --parser=prism --dump=parsetree -e '"#{foo}"' @ ProgramNode (location: (1,0)-(1,8)) +-- locals: [] +-- statements: @ StatementsNode (location: (1,0)-(1,8)) +-- body: (length: 1) +-- @ InterpolatedStringNode (location: (1,0)-(1,8)) +-- InterpolatedStringNodeFlags: nil +-- opening_loc: (1,0)-(1,1) = "\"" +-- parts: (length: 1) | +-- @ EmbeddedStatementsNode (location: (1,1)-(1,7)) | +-- opening_loc: (1,1)-(1,3) = "\#{" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | +-- statements: | | @ StatementsNode (location: (1,3)-(1,6)) | | +-- body: (length: 1) | | +-- @ CallNode (location: (1,3)-(1,6)) | | +-- CallNodeFlags: variable_call, ignore_visibility | | +-- receiver: nil | | +-- call_operator_loc: nil | | +-- name: :foo | | +-- message_loc: (1,3)-(1,6) = "foo" | | +-- opening_loc: nil | | +-- arguments: nil | | +-- closing_loc: nil | | +-- block: nil | +-- closing_loc: (1,6)-(1,7) = "}" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +-- closing_loc: (1,7)-(1,8) = "\"" ```
2025-01-03Implement SUPER NODE locationsydah
Notes: Merged: https://github.com/ruby/ruby/pull/11712
2025-01-03Speed up initial test creation in test_case_comprehensive.rb:Martin Dürst
- Change generate_case_mapping_tests to generate_single_byte_case_mapping_tests (all encodings using this method happen to be single-byte) - Change precalculation of codepoints by converting from specific encoding, not from Unicode. This reduces creation time. (See https://github.com/ruby/ruby/pull/7425 for a related proposal and some additional comments.)
2025-01-03Implement IF NODE locationsydah
The following Location information has been added This is the information required for parse.y to be a universal parser: ``` ❯ ruby --parser=prism --dump=parsetree -y -e "if a; elsif b; else end" @ ProgramNode (location: (1,0)-(1,23)) +-- locals: [] +-- statements: @ StatementsNode (location: (1,0)-(1,23)) +-- body: (length: 1) +-- @ IfNode (location: (1,0)-(1,23)) +-- if_keyword_loc: (1,0)-(1,2) = "if" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +-- predicate: | @ CallNode (location: (1,3)-(1,4)) | +-- CallNodeFlags: variable_call, ignore_visibility | +-- receiver: nil | +-- call_operator_loc: nil | +-- name: :a | +-- message_loc: (1,3)-(1,4) = "a" | +-- opening_loc: nil | +-- arguments: nil | +-- closing_loc: nil | +-- block: nil +-- then_keyword_loc: nil ^^^^^^^^^^^^^^^^^^^^^^^^^ +-- statements: nil +-- subsequent: | @ IfNode (location: (1,6)-(1,23)) | +-- if_keyword_loc: (1,6)-(1,11) = "elsif" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | +-- predicate: | | @ CallNode (location: (1,12)-(1,13)) | | +-- CallNodeFlags: variable_call, ignore_visibility | | +-- receiver: nil | | +-- call_operator_loc: nil | | +-- name: :b | | +-- message_loc: (1,12)-(1,13) = "b" | | +-- opening_loc: nil | | +-- arguments: nil | | +-- closing_loc: nil | | +-- block: nil | +-- then_keyword_loc: nil ^^^^^^^^^^^^^^^^^^^^^^^^^ | +-- statements: nil | +-- subsequent: | | @ ElseNode (location: (1,15)-(1,23)) | | +-- else_keyword_loc: (1,15)-(1,19) = "else" | | +-- statements: nil | | +-- end_keyword_loc: (1,20)-(1,23) = "end" | +-- end_keyword_loc: (1,20)-(1,23) = "end" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +-- end_keyword_loc: (1,20)-(1,23) = "end" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ```
2025-01-03Try all assertions in `TestM17N#test_regexp_usascii`Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/12483