This commit is contained in:
Kevin Newton 2023-11-14 15:50:53 -05:00
Родитель 93e9be2f69
Коммит befad28f30
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 0EAD74C79EC73F26
2 изменённых файлов: 0 добавлений и 115 удалений

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")