Begin working on a testing script.

This commit is contained in:
Danila Fedorin 2018-08-05 00:59:27 -07:00
parent 2ed2a4932c
commit a7e24c059b
2 changed files with 28 additions and 0 deletions

3
programs/empty.chalk Normal file
View File

@ -0,0 +1,3 @@
fun main(): u0 {
}

25
src/test.cr Normal file
View File

@ -0,0 +1,25 @@
require "./chalk/*"
module Chalk
regex = /([^.]+)\.chalk/
source_dir = "programs"
dest_dir = "out"
Dir.mkdir_p dest_dir
exit if !File.directory? source_dir
Dir.new(source_dir)
.children
.compact_map { |it| regex.match(it) }
.each do |match|
config = Ui::Config.new file: (source_dir + File::SEPARATOR + match[0]),
output: (dest_dir + File::SEPARATOR + match[1] + ".ch8"),
loglevel: Logger::Severity::ERROR,
mode: Ui::OutputMode::Binary
compiler = Compiler::Compiler.new config
begin
compiler.run
rescue e
puts "Exception compiling #{match[0]}"
end
end
end