зеркало из https://github.com/github/ruby.git
Resync prism delete bin/dot
This commit is contained in:
Родитель
93e9be2f69
Коммит
befad28f30
21
bin/dot
21
bin/dot
|
@ -1,21 +0,0 @@
|
|||
#!/usr/bin/env ruby
|
||||
# frozen_string_literal: true
|
||||
|
||||
$:.unshift(File.expand_path("../lib", __dir__))
|
||||
require "prism"
|
||||
|
||||
result =
|
||||
if ARGV[0] == "-e"
|
||||
Prism.parse(ARGV[1])
|
||||
else
|
||||
Prism.parse_file(ARGV[0] || "test.rb")
|
||||
end
|
||||
|
||||
File.write(
|
||||
"out.svg",
|
||||
IO.popen("dot -Tsvg", "w+") do |file|
|
||||
file.write(result.value.to_dot)
|
||||
file.close_write
|
||||
file.read
|
||||
end
|
||||
)
|
|
@ -1676,100 +1676,6 @@ module Prism
|
|||
], compare_ripper: false # Ripper does not check 'void value expression'.
|
||||
end
|
||||
|
||||
def test_void_value_expression_in_arguments
|
||||
source = <<~RUBY
|
||||
foo(return)
|
||||
foo(1, return)
|
||||
foo(*return)
|
||||
foo(**return)
|
||||
foo(&return)
|
||||
foo(return => 1)
|
||||
foo(:a => return)
|
||||
foo(a: return)
|
||||
RUBY
|
||||
message = 'Unexpected void value expression'
|
||||
assert_errors expression(source), source, [
|
||||
[message, 4..10],
|
||||
[message, 19..25],
|
||||
[message, 32..38],
|
||||
[message, 46..52],
|
||||
[message, 59..65],
|
||||
[message, 71..77],
|
||||
[message, 94..100],
|
||||
[message, 109..115],
|
||||
], compare_ripper: false # Ripper does not check 'void value expression'.
|
||||
end
|
||||
|
||||
def test_void_value_expression_in_hash
|
||||
source = <<~RUBY
|
||||
{ return => 1 }
|
||||
{ 1 => return }
|
||||
{ a: return }
|
||||
{ **return }
|
||||
RUBY
|
||||
message = 'Unexpected void value expression'
|
||||
assert_errors expression(source), source, [
|
||||
[message, 2..8],
|
||||
[message, 23..29],
|
||||
[message, 37..43],
|
||||
[message, 50..56],
|
||||
], compare_ripper: false # Ripper does not check 'void value expression'.
|
||||
end
|
||||
|
||||
def test_void_value_expression_in_arguments
|
||||
source = <<~RUBY
|
||||
foo(return)
|
||||
foo(1, return)
|
||||
foo(*return)
|
||||
foo(**return)
|
||||
foo(&return)
|
||||
foo(return => 1)
|
||||
foo(:a => return)
|
||||
foo(a: return)
|
||||
RUBY
|
||||
message = 'Unexpected void value expression'
|
||||
assert_errors expression(source), source, [
|
||||
[message, 4..10],
|
||||
[message, 19..25],
|
||||
[message, 32..38],
|
||||
[message, 46..52],
|
||||
[message, 59..65],
|
||||
[message, 71..77],
|
||||
[message, 94..100],
|
||||
[message, 109..115],
|
||||
], compare_ripper: false # Ripper does not check 'void value expression'.
|
||||
end
|
||||
|
||||
def test_void_value_expression_in_unary_call
|
||||
source = <<~RUBY
|
||||
+(return)
|
||||
not return
|
||||
RUBY
|
||||
message = 'Unexpected void value expression'
|
||||
assert_errors expression(source), source, [
|
||||
[message, 2..8],
|
||||
[message, 14..20],
|
||||
], compare_ripper: false # Ripper does not check 'void value expression'.
|
||||
end
|
||||
|
||||
def test_void_value_expression_in_binary_call
|
||||
source = <<~RUBY
|
||||
1 + (return)
|
||||
(return) + 1
|
||||
1 and (return)
|
||||
(return) and 1
|
||||
1 or (return)
|
||||
(return) or 1
|
||||
RUBY
|
||||
message = 'Unexpected void value expression'
|
||||
assert_errors expression(source), source, [
|
||||
[message, 5..11],
|
||||
[message, 14..20],
|
||||
[message, 42..48],
|
||||
[message, 71..77],
|
||||
], compare_ripper: false # Ripper does not check 'void value expression'.
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def assert_errors(expected, source, errors, compare_ripper: RUBY_ENGINE == "ruby")
|
||||
|
|
Загрузка…
Ссылка в новой задаче