mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Refactor test
[Fix GH-1946] From: Josh Cheek <josh.cheek@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8eb96c6137
commit
32aeb3dd4e
1 changed files with 2 additions and 10 deletions
|
@ -1,5 +1,6 @@
|
||||||
# frozen_string_literal: false
|
# frozen_string_literal: false
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
|
require 'tempfile'
|
||||||
|
|
||||||
class RubyVM
|
class RubyVM
|
||||||
module AST
|
module AST
|
||||||
|
@ -161,16 +162,7 @@ class TestAst < Test::Unit::TestCase
|
||||||
Tempfile.create(%w"test_ast .rb") do |f|
|
Tempfile.create(%w"test_ast .rb") do |f|
|
||||||
f.puts "end"
|
f.puts "end"
|
||||||
f.close
|
f.close
|
||||||
path = f.path
|
assert_raise(SyntaxError) { RubyVM::AST.parse_file(f.path) }
|
||||||
assert_in_out_err(%W[- #{path}], "#{<<-"begin;"}\n#{<<-"end;"}", /keyword_end/, [], success: true)
|
|
||||||
begin;
|
|
||||||
path = ARGV[0]
|
|
||||||
begin
|
|
||||||
RubyVM::AST.parse_file(path)
|
|
||||||
rescue SyntaxError => e
|
|
||||||
puts e.message
|
|
||||||
end
|
|
||||||
end;
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue