Compile generated parser with a test file
This commit is contained in:
parent
748c219625
commit
3c874ae4c1
@ -1,16 +1,16 @@
|
|||||||
require "fileutils"
|
require "fileutils"
|
||||||
|
|
||||||
def write_grammar(grammar)
|
def write_grammar(grammar)
|
||||||
File.write("spec/run/test.i", grammar)
|
File.write("spec/run/testparser.i", grammar)
|
||||||
end
|
end
|
||||||
|
|
||||||
def build_parser
|
def build_parser
|
||||||
result = system(*%w[./imbecile.sh spec/run/test.i spec/run/test.d])
|
result = system(*%w[./imbecile.sh spec/run/testparser.i spec/run/testparser.d])
|
||||||
expect(result).to be_truthy
|
expect(result).to be_truthy
|
||||||
end
|
end
|
||||||
|
|
||||||
def compile
|
def compile(test_file)
|
||||||
result = system(*%w[gdc -o spec/run/test spec/run/test.d])
|
result = system(*%w[gdc -o spec/run/testparser spec/run/testparser.d], test_file)
|
||||||
expect(result).to be_truthy
|
expect(result).to be_truthy
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -30,6 +30,6 @@ rule Start [] <<
|
|||||||
>>
|
>>
|
||||||
EOF
|
EOF
|
||||||
build_parser
|
build_parser
|
||||||
compile
|
compile("spec/test_d_lexer.d")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
4
spec/test_d_lexer.d
Normal file
4
spec/test_d_lexer.d
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
int main()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user