зеркало из https://github.com/github/ruby.git
[ruby/prism] Simplify locals test now that all fixtures are valid
https://github.com/ruby/prism/commit/0d32af5719
This commit is contained in:
Родитель
478b4ef9de
Коммит
b09604e1fd
|
@ -30,10 +30,10 @@ if type in 1
|
|||
elsif type in B
|
||||
end
|
||||
|
||||
if 1
|
||||
if f1
|
||||
lambda do |_|
|
||||
end
|
||||
elsif 2
|
||||
elsif f2
|
||||
lambda do |_|
|
||||
end
|
||||
else
|
||||
|
|
|
@ -17,51 +17,11 @@ require_relative "test_helper"
|
|||
|
||||
module Prism
|
||||
class LocalsTest < TestCase
|
||||
invalid = []
|
||||
todos = []
|
||||
|
||||
# Invalid break
|
||||
invalid << "break.txt"
|
||||
invalid << "if.txt"
|
||||
invalid << "rescue.txt"
|
||||
invalid << "seattlerb/block_break.txt"
|
||||
invalid << "unless.txt"
|
||||
invalid << "whitequark/break.txt"
|
||||
invalid << "whitequark/break_block.txt"
|
||||
|
||||
# Invalid next
|
||||
invalid << "next.txt"
|
||||
invalid << "seattlerb/block_next.txt"
|
||||
invalid << "unparser/corpus/literal/control.txt"
|
||||
invalid << "whitequark/next.txt"
|
||||
invalid << "whitequark/next_block.txt"
|
||||
|
||||
# Invalid redo
|
||||
invalid << "keywords.txt"
|
||||
invalid << "whitequark/redo.txt"
|
||||
|
||||
# Invalid retry
|
||||
invalid << "whitequark/retry.txt"
|
||||
|
||||
# Invalid yield
|
||||
invalid << "seattlerb/dasgn_icky2.txt"
|
||||
invalid << "seattlerb/yield_arg.txt"
|
||||
invalid << "seattlerb/yield_call_assocs.txt"
|
||||
invalid << "seattlerb/yield_empty_parens.txt"
|
||||
invalid << "unparser/corpus/literal/yield.txt"
|
||||
invalid << "whitequark/args_assocs.txt"
|
||||
invalid << "whitequark/args_assocs_legacy.txt"
|
||||
invalid << "whitequark/yield.txt"
|
||||
invalid << "yield.txt"
|
||||
|
||||
# Dead code eliminated
|
||||
invalid << "whitequark/ruby_bug_10653.txt"
|
||||
|
||||
base = File.join(__dir__, "fixtures")
|
||||
skips = invalid | todos
|
||||
|
||||
Dir["**/*.txt", base: base].each do |relative|
|
||||
next if skips.include?(relative)
|
||||
# Skip this fixture because it has a different number of locals because
|
||||
# CRuby is eliminating dead code.
|
||||
next if relative == "whitequark/ruby_bug_10653.txt"
|
||||
|
||||
filepath = File.join(base, relative)
|
||||
define_method("test_#{relative}") { assert_locals(filepath) }
|
||||
|
|
|
@ -391,9 +391,16 @@
|
|||
└── @ IfNode (location: (33,0)-(42,3))
|
||||
├── if_keyword_loc: (33,0)-(33,2) = "if"
|
||||
├── predicate:
|
||||
│ @ IntegerNode (location: (33,3)-(33,4))
|
||||
│ ├── flags: decimal
|
||||
│ └── value: 1
|
||||
│ @ CallNode (location: (33,3)-(33,5))
|
||||
│ ├── flags: variable_call, ignore_visibility
|
||||
│ ├── receiver: ∅
|
||||
│ ├── call_operator_loc: ∅
|
||||
│ ├── name: :f1
|
||||
│ ├── message_loc: (33,3)-(33,5) = "f1"
|
||||
│ ├── opening_loc: ∅
|
||||
│ ├── arguments: ∅
|
||||
│ ├── closing_loc: ∅
|
||||
│ └── block: ∅
|
||||
├── then_keyword_loc: ∅
|
||||
├── statements:
|
||||
│ @ StatementsNode (location: (34,2)-(35,5))
|
||||
|
@ -434,9 +441,16 @@
|
|||
│ @ IfNode (location: (36,0)-(42,3))
|
||||
│ ├── if_keyword_loc: (36,0)-(36,5) = "elsif"
|
||||
│ ├── predicate:
|
||||
│ │ @ IntegerNode (location: (36,6)-(36,7))
|
||||
│ │ ├── flags: decimal
|
||||
│ │ └── value: 2
|
||||
│ │ @ CallNode (location: (36,6)-(36,8))
|
||||
│ │ ├── flags: variable_call, ignore_visibility
|
||||
│ │ ├── receiver: ∅
|
||||
│ │ ├── call_operator_loc: ∅
|
||||
│ │ ├── name: :f2
|
||||
│ │ ├── message_loc: (36,6)-(36,8) = "f2"
|
||||
│ │ ├── opening_loc: ∅
|
||||
│ │ ├── arguments: ∅
|
||||
│ │ ├── closing_loc: ∅
|
||||
│ │ └── block: ∅
|
||||
│ ├── then_keyword_loc: ∅
|
||||
│ ├── statements:
|
||||
│ │ @ StatementsNode (location: (37,2)-(38,5))
|
||||
|
|
Загрузка…
Ссылка в новой задаче