diff --git a/test/prism/fixtures/whitequark/cond_eflipflop_with_beginless_range.txt b/test/prism/fixtures/whitequark/cond_eflipflop_with_beginless_range.txt new file mode 100644 index 0000000000..757863b12b --- /dev/null +++ b/test/prism/fixtures/whitequark/cond_eflipflop_with_beginless_range.txt @@ -0,0 +1 @@ +if ...bar; end diff --git a/test/prism/fixtures/whitequark/cond_eflipflop_with_endless_range.txt b/test/prism/fixtures/whitequark/cond_eflipflop_with_endless_range.txt new file mode 100644 index 0000000000..8a3b815ec9 --- /dev/null +++ b/test/prism/fixtures/whitequark/cond_eflipflop_with_endless_range.txt @@ -0,0 +1 @@ +if foo...; end diff --git a/test/prism/fixtures/whitequark/cond_iflipflop_with_beginless_range.txt b/test/prism/fixtures/whitequark/cond_iflipflop_with_beginless_range.txt new file mode 100644 index 0000000000..4ff5b09690 --- /dev/null +++ b/test/prism/fixtures/whitequark/cond_iflipflop_with_beginless_range.txt @@ -0,0 +1 @@ +if ..bar; end diff --git a/test/prism/fixtures/whitequark/cond_iflipflop_with_endless_range.txt b/test/prism/fixtures/whitequark/cond_iflipflop_with_endless_range.txt new file mode 100644 index 0000000000..2739ad0e2a --- /dev/null +++ b/test/prism/fixtures/whitequark/cond_iflipflop_with_endless_range.txt @@ -0,0 +1 @@ +if foo..; end diff --git a/test/prism/fixtures/whitequark/numparam_ruby_bug_19025.txt b/test/prism/fixtures/whitequark/numparam_ruby_bug_19025.txt new file mode 100644 index 0000000000..f9ffd4329a --- /dev/null +++ b/test/prism/fixtures/whitequark/numparam_ruby_bug_19025.txt @@ -0,0 +1 @@ +p { [_1 **2] } diff --git a/test/prism/fixtures/whitequark/parser_bug_989.txt b/test/prism/fixtures/whitequark/parser_bug_989.txt new file mode 100644 index 0000000000..b7b99612b4 --- /dev/null +++ b/test/prism/fixtures/whitequark/parser_bug_989.txt @@ -0,0 +1,3 @@ + <<-HERE + content + HERE diff --git a/test/prism/ruby_parser_test.rb b/test/prism/ruby_parser_test.rb index c9883574a6..8edeac4b4f 100644 --- a/test/prism/ruby_parser_test.rb +++ b/test/prism/ruby_parser_test.rb @@ -84,6 +84,7 @@ module Prism whitequark/if_while_after_class__since_32.txt whitequark/lvar_injecting_match.txt whitequark/not.txt + whitequark/numparam_ruby_bug_19025.txt whitequark/op_asgn_cmd.txt whitequark/parser_bug_640.txt whitequark/parser_slash_slash_n_escaping_in_literals.txt diff --git a/test/prism/snapshots/whitequark/cond_eflipflop_with_beginless_range.txt b/test/prism/snapshots/whitequark/cond_eflipflop_with_beginless_range.txt new file mode 100644 index 0000000000..05972521e8 --- /dev/null +++ b/test/prism/snapshots/whitequark/cond_eflipflop_with_beginless_range.txt @@ -0,0 +1,27 @@ +@ ProgramNode (location: (1,0)-(1,14)) +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(1,14)) + └── body: (length: 1) + └── @ IfNode (location: (1,0)-(1,14)) + ├── if_keyword_loc: (1,0)-(1,2) = "if" + ├── predicate: + │ @ FlipFlopNode (location: (1,3)-(1,9)) + │ ├── flags: exclude_end + │ ├── left: ∅ + │ ├── right: + │ │ @ CallNode (location: (1,6)-(1,9)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :bar + │ │ ├── message_loc: (1,6)-(1,9) = "bar" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ └── operator_loc: (1,3)-(1,6) = "..." + ├── then_keyword_loc: ∅ + ├── statements: ∅ + ├── consequent: ∅ + └── end_keyword_loc: (1,11)-(1,14) = "end" diff --git a/test/prism/snapshots/whitequark/cond_eflipflop_with_endless_range.txt b/test/prism/snapshots/whitequark/cond_eflipflop_with_endless_range.txt new file mode 100644 index 0000000000..c85ff292a5 --- /dev/null +++ b/test/prism/snapshots/whitequark/cond_eflipflop_with_endless_range.txt @@ -0,0 +1,27 @@ +@ ProgramNode (location: (1,0)-(1,14)) +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(1,14)) + └── body: (length: 1) + └── @ IfNode (location: (1,0)-(1,14)) + ├── if_keyword_loc: (1,0)-(1,2) = "if" + ├── predicate: + │ @ FlipFlopNode (location: (1,3)-(1,9)) + │ ├── flags: exclude_end + │ ├── left: + │ │ @ CallNode (location: (1,3)-(1,6)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (1,3)-(1,6) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── right: ∅ + │ └── operator_loc: (1,6)-(1,9) = "..." + ├── then_keyword_loc: ∅ + ├── statements: ∅ + ├── consequent: ∅ + └── end_keyword_loc: (1,11)-(1,14) = "end" diff --git a/test/prism/snapshots/whitequark/cond_iflipflop_with_beginless_range.txt b/test/prism/snapshots/whitequark/cond_iflipflop_with_beginless_range.txt new file mode 100644 index 0000000000..63b87ffd49 --- /dev/null +++ b/test/prism/snapshots/whitequark/cond_iflipflop_with_beginless_range.txt @@ -0,0 +1,27 @@ +@ ProgramNode (location: (1,0)-(1,13)) +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(1,13)) + └── body: (length: 1) + └── @ IfNode (location: (1,0)-(1,13)) + ├── if_keyword_loc: (1,0)-(1,2) = "if" + ├── predicate: + │ @ FlipFlopNode (location: (1,3)-(1,8)) + │ ├── flags: ∅ + │ ├── left: ∅ + │ ├── right: + │ │ @ CallNode (location: (1,5)-(1,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :bar + │ │ ├── message_loc: (1,5)-(1,8) = "bar" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ └── operator_loc: (1,3)-(1,5) = ".." + ├── then_keyword_loc: ∅ + ├── statements: ∅ + ├── consequent: ∅ + └── end_keyword_loc: (1,10)-(1,13) = "end" diff --git a/test/prism/snapshots/whitequark/cond_iflipflop_with_endless_range.txt b/test/prism/snapshots/whitequark/cond_iflipflop_with_endless_range.txt new file mode 100644 index 0000000000..328a2da153 --- /dev/null +++ b/test/prism/snapshots/whitequark/cond_iflipflop_with_endless_range.txt @@ -0,0 +1,27 @@ +@ ProgramNode (location: (1,0)-(1,13)) +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(1,13)) + └── body: (length: 1) + └── @ IfNode (location: (1,0)-(1,13)) + ├── if_keyword_loc: (1,0)-(1,2) = "if" + ├── predicate: + │ @ FlipFlopNode (location: (1,3)-(1,8)) + │ ├── flags: ∅ + │ ├── left: + │ │ @ CallNode (location: (1,3)-(1,6)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (1,3)-(1,6) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── right: ∅ + │ └── operator_loc: (1,6)-(1,8) = ".." + ├── then_keyword_loc: ∅ + ├── statements: ∅ + ├── consequent: ∅ + └── end_keyword_loc: (1,10)-(1,13) = "end" diff --git a/test/prism/snapshots/whitequark/numparam_ruby_bug_19025.txt b/test/prism/snapshots/whitequark/numparam_ruby_bug_19025.txt new file mode 100644 index 0000000000..396238cbbf --- /dev/null +++ b/test/prism/snapshots/whitequark/numparam_ruby_bug_19025.txt @@ -0,0 +1,49 @@ +@ ProgramNode (location: (1,0)-(1,14)) +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(1,14)) + └── body: (length: 1) + └── @ CallNode (location: (1,0)-(1,14)) + ├── flags: ignore_visibility + ├── receiver: ∅ + ├── call_operator_loc: ∅ + ├── name: :p + ├── message_loc: (1,0)-(1,1) = "p" + ├── opening_loc: ∅ + ├── arguments: ∅ + ├── closing_loc: ∅ + └── block: + @ BlockNode (location: (1,2)-(1,14)) + ├── locals: [:_1] + ├── parameters: + │ @ NumberedParametersNode (location: (1,2)-(1,14)) + │ └── maximum: 1 + ├── body: + │ @ StatementsNode (location: (1,4)-(1,12)) + │ └── body: (length: 1) + │ └── @ ArrayNode (location: (1,4)-(1,12)) + │ ├── flags: ∅ + │ ├── elements: (length: 1) + │ │ └── @ CallNode (location: (1,5)-(1,11)) + │ │ ├── flags: ∅ + │ │ ├── receiver: + │ │ │ @ LocalVariableReadNode (location: (1,5)-(1,7)) + │ │ │ ├── name: :_1 + │ │ │ └── depth: 0 + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :** + │ │ ├── message_loc: (1,8)-(1,10) = "**" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: + │ │ │ @ ArgumentsNode (location: (1,10)-(1,11)) + │ │ │ ├── flags: ∅ + │ │ │ └── arguments: (length: 1) + │ │ │ └── @ IntegerNode (location: (1,10)-(1,11)) + │ │ │ ├── flags: decimal + │ │ │ └── value: 2 + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── opening_loc: (1,4)-(1,5) = "[" + │ └── closing_loc: (1,11)-(1,12) = "]" + ├── opening_loc: (1,2)-(1,3) = "{" + └── closing_loc: (1,13)-(1,14) = "}" diff --git a/test/prism/snapshots/whitequark/parser_bug_989.txt b/test/prism/snapshots/whitequark/parser_bug_989.txt new file mode 100644 index 0000000000..c241d6127f --- /dev/null +++ b/test/prism/snapshots/whitequark/parser_bug_989.txt @@ -0,0 +1,11 @@ +@ ProgramNode (location: (1,1)-(1,8)) +├── locals: [] +└── statements: + @ StatementsNode (location: (1,1)-(1,8)) + └── body: (length: 1) + └── @ StringNode (location: (1,1)-(1,8)) + ├── flags: ∅ + ├── opening_loc: (1,1)-(1,8) = "<<-HERE" + ├── content_loc: (2,0)-(3,0) = "\t\tcontent\n" + ├── closing_loc: (3,0)-(4,0) = "\tHERE\n" + └── unescaped: "\t\tcontent\n"