summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2023-12-04[PRISM] Implement `PM_INTERPOLATED_REGULAR_EXPRESSION_NODE`eileencodes
Implements `PM_INTERPOLATED_REGULAR_EXPRESSION_NODE` for `defined?` Code: ```ruby defined?(/#{1}/) ``` ``` "********* Ruby *************" == disasm: #<ISeq:<compiled>@<compiled>:0 (0,0)-(0,16)> 0000 putobject "expression" 0002 leave "********* PRISM *************" == disasm: #<ISeq:<compiled>@<compiled>:0 (0,0)-(0,16)> 0000 putobject "expression" 0002 leave ```
2023-12-04[PRISM] Implement `PM_INTERPOLATED_STRING_NODE`eileencodes
Implements `PM_INTERPOLATED_STRING_NODE` for `defined?` Code: ```ruby defined?("#{expr}") ``` ``` "********* Ruby *************" == disasm: #<ISeq:<compiled>@<compiled>:0 (0,0)-(0,19)> 0000 putobject "expression" 0002 leave "********* PRISM *************" == disasm: #<ISeq:<compiled>@<compiled>:0 (0,0)-(0,19)> 0000 putobject "expression" 0002 leave ```
2023-12-04[PRISM] Fix `PM_PARENTHESES_NODE`eileencodes
In #9101 I only accounted for an empty paren. This change implements the `PM_PARENTHESES_NODE` for when it's `nil` and when it's an expression. Code: ```ruby defined?(("a")) ``` ``` "********* Ruby *************" == disasm: #<ISeq:<compiled>@<compiled>:0 (0,0)-(0,15)> 0000 putobject "expression" 0002 leave "********* PRISM *************" == disasm: #<ISeq:<compiled>@<compiled>:0 (0,0)-(0,15)> 0000 putobject "expression" 0002 leave ```
2023-12-04[Prism] Implement backref and numbered reference for `defined?`eileencodes
This PR implements `PM_BACK_REFERENCE_READ_NODE` and `PM_NUMBERED_REFERENCE_READ_NODE` for `defined?`. The following now works: * `PM_NUMBERED_REFERENCE_READ_NODE` ``` defined? $1 defined? $2 ``` Instructions: ``` "********* RUBY *************" == disasm: #<ISeq:<compiled>@<compiled>:0 (0,0)-(0,12)> 0000 putnil 0001 defined ref, :$1, "global-variable" 0005 leave "********* PRISM *************" == disasm: #<ISeq:<compiled>@<compiled>:0 (0,0)-(0,12)> 0000 putnil 0001 defined ref, :$1, "global-variable" 0005 leave ``` * `PM_BACK_REFERENCE_READ_NODE` ``` defined? $' defined? $` defined? $& ``` Instructions: ``` "********* RUBY *************" == disasm: #<ISeq:<compiled>@<compiled>:0 (0,0)-(0,12)> 0000 putnil 0001 defined ref, :$`, "global-variable" 0005 leave "********* PRISM *************" == disasm: #<ISeq:<compiled>@<compiled>:0 (0,0)-(0,12)> 0000 putnil 0001 defined ref, :$`, "global-variable" 0005 leave ```
2023-12-04[PRISM] Fix compilation for NextNodeJemma Issroff
This code was almost enitrely the same as the existing compiler's code for its NextNode.
2023-12-04[ruby/prism] Ripper compat docs updateKevin Newton
https://github.com/ruby/prism/commit/5f70b32b02
2023-12-04[ruby/prism] Check "void value expression" for array literalsTSUYUSATO Kitsune
Fix https://github.com/ruby/prism/pull/1978 https://github.com/ruby/prism/commit/194c997d0a
2023-12-03Revert "Add missing GVL hooks for M:N threads and ractors"John Hawthorn
This reverts commit ad54fbf281ca1935e79f4df1460b0106ba76761e.
2023-12-03[ruby/irb] Disable pager in eval_history testtomoya ishida
(https://github.com/ruby/irb/pull/799) https://github.com/ruby/irb/commit/ee85e84935
2023-12-02Add missing GVL hooks for M:N threads and ractorsJohn Hawthorn
[Bug #20019] This fixes GVL instrumentation in three locations it was missing: - Suspending when blocking on a Ractor - Suspending when doing a coroutine transfer from an M:N thread - Resuming after an M:N thread starts Co-authored-by: Matthew Draper <matthew@trebex.net>
2023-12-02[ruby/rdoc] Markup punctuations need to be separated with a spaceNobuyoshi Nakada
https://github.com/ruby/rdoc/commit/83f0149fc1
2023-12-02[ruby/irb] Implement `history` commandGary Tou
(https://github.com/ruby/irb/pull/761) * Implement `history` command Lists IRB input history with indices. Also aliased as `hist`. * Add tests for `history` command * Address feedback: `puts` with multiple arguments instead of `join`ing * Address feedback: Handle nil from splitting an empty input string * Refactor line truncation * Add `-g` grep option to `history` command * Add `history` command to README * Remove unused `*args` parameter * Allow spaces to be included in grep * Allow `/` to be included in grep regex * Handle `input` being an empty string * Exclude "#{index}: " from matching the grep regex * Add new line after joining https://github.com/ruby/irb/commit/3f9eacbfa9
2023-12-01Implement paren node for `defined?`eileencodes
Implements and adds a test for passing a parentheses node to `defined?`.
2023-12-01[ruby/prism] Prism.parse_success?(source)Kevin Newton
A lot of tools use Ripper/RubyVM::AbstractSyntaxTree to determine if a source is valid. These tools both create an AST instead of providing an API that will return a boolean only. This new API only creates the C structs, but doesn't bother reifying them into Ruby/the serialization API. Instead it only returns true/false, which is significantly more efficient. https://github.com/ruby/prism/commit/7014740118
2023-12-01[ruby/prism] Fix parsing heredoc endsHaldun Bayhantopcu
https://github.com/ruby/prism/commit/aa8c702271
2023-12-01Implements missing literals for `defined?`eileencodes
This PR implements the following literals: - String - Symbols - Integers - Floats - Regexs - Ranges - Lambdas - Hashes and tests for them.
2023-12-01Make String#undump compaction safePeter Zhu
2023-12-02[Bug #20033] Dynamic regexp should not assign capturesNobuyoshi Nakada
2023-12-01[ruby/prism] Provide heredoc? queriesKevin Newton
https://github.com/ruby/prism/commit/e148e8fe6a
2023-12-01[PRISM] Account for RescueNodes with no statementsJemma Issroff
We need a PUTNIL if a RescueNode has no statements.
2023-12-01[PRISM] Fix behavior of BlockParameters with only one parameterJemma Issroff
This commit sets the ambiguous param flag if there is only one parameter on a block node. It also fixes a small bug with a trailing comma on params.
2023-12-01[ruby/irb] Scrub past history input before splithogelog
(https://github.com/ruby/irb/pull/795) * Scrub past history input before split * Don't rewrite ENV["LANG"] https://github.com/ruby/irb/commit/0f344f66d9
2023-12-02[Bug #19838] Flush delayed token nonconsecutive with the next tokenNobuyoshi Nakada
2023-12-01[PRISM] Restructure parametersJemma Issroff
Prior to this commit, we weren't accounting for hidden variables on the locals table, so we would have inconsistencies on the stack. This commit fixes params, and introduces a hidden_variable_count on the scope, both of which fix parameters.
2023-12-01[ruby/prism] Change numbered parametersKevin Newton
Previously numbered parameters were a field on blocks and lambdas that indicated the maximum number of numbered parameters in either the block or lambda, respectively. However they also had a parameters field that would always be nil in these cases. This changes it so that we introduce a NumberedParametersNode that goes in place of parameters, which has a single uint8_t maximum field on it. That field contains the maximum numbered parameter in either the block or lambda. As a part of the PR, I'm introducing a new UInt8Field type that can be used on nodes, which is just to make it a little more explicit what the maximum values can be (the maximum is actually 9, since it only goes up to _9). Plus we can do a couple of nice things in serialization like just read a single byte. https://github.com/ruby/prism/commit/2d87303903
2023-12-01[PRISM] Compile RescueNodeMatt Valentine-House
2023-12-01[ruby/prism] Update snapshotsKevin Newton
https://github.com/ruby/prism/commit/f4c80c67dc
2023-12-01[ruby/prism] Fix comments after HEREDOCs again.Martin Emde
The problem was deeper than just looking back a single token. You can push the heredoc_end token way back into the list. We need to save the last location of a heredoc end to see if it's the last token in the file. Fixes https://github.com/ruby/prism/pull/1954 https://github.com/ruby/prism/commit/91dfd4eecd
2023-12-01[ruby/prism] Improve to handle unterminated stringsTSUYUSATO Kitsune
Fix https://github.com/ruby/prism/pull/1946 This fixes to set an error position for unterminated strings to the opening delimiters. Previously, the error position was set to the end of the delimiter. The same fix applies to other string-like literals. Additionally, this fixes https://github.com/ruby/prism/pull/1946; that is, it adds the last part of the string even though the string literal does not terminate. https://github.com/ruby/prism/commit/c1240baafd
2023-12-01[PRISM] Remove transparent scope nodesMatt Valentine-House
2023-12-01[ruby/prism] Add test/prism/snapshots/heredoc_with_comment.txtHiroshi SHIBATA
https://github.com/ruby/prism/commit/97b296a0f7
2023-12-01lib/helper only needs on flori/json repoHiroshi SHIBATA
2023-12-01Manually merged from flori/jsonHiroshi SHIBATA
> https://github.com/flori/json/pull/525 > Rename escape_slash in script_safe and also escape E+2028 and E+2029 Co-authored-by: Jean Boussier <jean.boussier@gmail.com> > https://github.com/flori/json/pull/454 > Remove unnecessary initialization of create_id in JSON.parse() Co-authored-by: Watson <watson1978@gmail.com>
2023-12-01Rename escape_slash in script_safe and also escape E+2028 and E+2029Jean Boussier
It is rather common to directly interpolate JSON string inside <script> tags in HTML as to provide configuration or parameters to a script. However this may lead to XSS vulnerabilities, to prevent that 3 characters need to be escaped: - `/` (forward slash) - `U+2028` (LINE SEPARATOR) - `U+2029` (PARAGRAPH SEPARATOR) The forward slash need to be escaped to prevent closing the script tag early, and the other two are valid JSON but invalid Javascript and can be used to break JS parsing. Given that the intent of escaping forward slash is the same than escaping U+2028 and U+2029, I chos to rename and repurpose the existing `escape_slash` option.
2023-12-01[flori/json] Fix "unexpected token" offset for InfinityJohn Hawthorn
Previously in the JSON::Ext parser, when we encountered an "Infinity" token (and weren't allowing NaN/Infinity) we would try to display the "unexpected token" at the character before. https://github.com/flori/json/commit/42ac170712
2023-12-01[flori/json] tests/ractor_test.rb: make assert_separately availableLucas Kanashiro
Require tests/lib/helper.rb to avoid: NoMethodError: undefined method `assert_separately' https://github.com/flori/json/commit/a81bcc0328
2023-12-01Dispatch invalid hex escape content tooNobuyoshi Nakada
2023-12-01[Bug #20030] dispatch invalid escaped character without ignoring itNobuyoshi Nakada
2023-12-01Fixup with review commentMisaki Shioi
https://github.com/ruby/ruby/pull/9088#discussion_r1411490445
2023-12-01Relax test conditions to velify Socket::ResolutionError#error_codeMisaki Shioi
The test for Socket::ResolutionError#error_code fails in the FreeBSD environment with this test condition. Because Socket::ResolutionError#error_code returns Socket::EAI_FAIL instead of Socket::EAI_FAMILY. https://rubyci.s3.amazonaws.com/freebsd12/ruby-master/log/20231130T103002Z.fail.html.gz This PR avoids the test failure by relaxing the condition. Also changed the domain for testing to `example.com`.
2023-11-30[ruby/prism] Document remaining encodingsKevin Newton
https://github.com/ruby/prism/commit/b9510aed40
2023-11-30[ruby/prism] CESU encodingKevin Newton
https://github.com/ruby/prism/commit/2d5b9c2b3c
2023-11-30[ruby/prism] EUC-TW encodingKevin Newton
https://github.com/ruby/prism/commit/edfb54f039
2023-11-30[ruby/prism] GB18030 encodingKevin Newton
https://github.com/ruby/prism/commit/ca3ab7ec89
2023-11-30[ruby/prism] Emacs MULE encodingsKevin Newton
https://github.com/ruby/prism/commit/4c06b6c42e
2023-11-30[PRISM] Big5 encodingsKevin Newton
2023-11-30[ruby/prism] EUC-KR encodingsKevin Newton
https://github.com/ruby/prism/commit/ba5218385a
2023-11-30[ruby/prism] Support other EUC-JP encodingsKevin Newton
https://github.com/ruby/prism/commit/d040337ce9
2023-11-30[PRISM] Alias CP51932 to EUC-JPKevin Newton
2023-11-30[PRISM] Consolidate SJIS encodingsKevin Newton