Run test executable; build with unit tests

This commit is contained in:
Josh Holtrop 2021-07-06 10:03:42 -04:00
parent 3c874ae4c1
commit ca7d4862f9
2 changed files with 25 additions and 14 deletions

View File

@ -1,5 +1,6 @@
require "fileutils"
describe Imbecile do
def write_grammar(grammar)
File.write("spec/run/testparser.i", grammar)
end
@ -10,11 +11,15 @@ def build_parser
end
def compile(test_file)
result = system(*%w[gdc -o spec/run/testparser spec/run/testparser.d], test_file)
result = system(*%w[gdc -funittest -o spec/run/testparser spec/run/testparser.d], test_file)
expect(result).to be_truthy
end
def run
result = system("spec/run/testparser")
expect(result).to be_truthy
end
describe Imbecile do
before(:each) do
FileUtils.rm_rf("spec/run")
FileUtils.mkdir_p("spec/run")
@ -31,5 +36,6 @@ rule Start [] <<
EOF
build_parser
compile("spec/test_d_lexer.d")
run
end
end

View File

@ -2,3 +2,8 @@ int main()
{
return 0;
}
unittest
{
assert(true);
}