way to fix current test cases (if known to be correct)
This commit is contained in:
parent
e2054660ce
commit
692b51a9de
@ -1,17 +1,32 @@
|
|||||||
require_relative "setup"
|
require_relative "setup"
|
||||||
require "parslet/convenience"
|
require "parslet/convenience"
|
||||||
require "ast/sexp"
|
require "ast/sexp"
|
||||||
|
require "pp"
|
||||||
|
|
||||||
class TestAll < MiniTest::Test
|
class TestAll < MiniTest::Test
|
||||||
include AST::Sexp
|
include AST::Sexp
|
||||||
|
SEPERATOR = "-- -- --"
|
||||||
|
|
||||||
def check_file file
|
def check_file file
|
||||||
inn , out = File.new(file).read.split("-- -- --")
|
inn , out = File.new(file).read.split(SEPERATOR)
|
||||||
sexp = eval(out)
|
sexp = eval(out)
|
||||||
syntax = Parser::Salama.new.parse_with_debug(inn)
|
syntax = Parser::Salama.new.parse_with_debug(inn)
|
||||||
result = Parser::Transform.new.apply(syntax)
|
result = Parser::Transform.new.apply(syntax)
|
||||||
equal = (sexp == result)
|
equal = (sexp == result)
|
||||||
puts "\n" + result.inspect unless equal
|
unless equal
|
||||||
|
if ENV["FIX"]
|
||||||
|
out_file = File.new(file, "w")
|
||||||
|
out_file.puts inn
|
||||||
|
out_file.puts SEPERATOR
|
||||||
|
out_file.puts result.inspect
|
||||||
|
out_file.close
|
||||||
|
puts "Fixed #{file}"
|
||||||
|
sexp = result
|
||||||
|
else
|
||||||
|
pp syntax
|
||||||
|
puts result.inspect
|
||||||
|
end
|
||||||
|
end
|
||||||
assert_equal sexp , result
|
assert_equal sexp , result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user