test the hello_world
This commit is contained in:
parent
73ab612997
commit
6e67d04fcb
@ -3,6 +3,22 @@ class CMDTEST_master_batch < Cmdtest::Testcase
|
|||||||
import_file "test/file2str.h", "./"
|
import_file "test/file2str.h", "./"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_hw
|
||||||
|
source = "hello_world2"
|
||||||
|
|
||||||
|
import_file "test/#{source}.tbsp", "./"
|
||||||
|
|
||||||
|
cmd "tbsp -o #{source}.tb.c #{source}.tbsp" do
|
||||||
|
created_files ["#{source}.tb.c"]
|
||||||
|
end
|
||||||
|
cmd "gcc -w -o #{source}.out #{source}.tb.c $(pkg-config --cflags --libs tree-sitter tree-sitter-c)" do
|
||||||
|
created_files ["#{source}.out"]
|
||||||
|
end
|
||||||
|
cmd "./#{source}.out" do
|
||||||
|
stdout_equal /.+/
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def test_converter
|
def test_converter
|
||||||
source = "convert"
|
source = "convert"
|
||||||
|
|
||||||
|
13
test/hello_world2.tbsp
Normal file
13
test/hello_world2.tbsp
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
%top{
|
||||||
|
int fun(void) { return 10; }
|
||||||
|
}
|
||||||
|
%language c
|
||||||
|
%%
|
||||||
|
enter translation_unit { puts("Hello World!"); }
|
||||||
|
%%
|
||||||
|
|
||||||
|
// @BAKE tbsp $@; gcc top_function.tb.c $(pkg-config --libs tree-sitter tree-sitter-c); ./a.out
|
||||||
|
signed main(void) {
|
||||||
|
tbtraverse("int i = 0;");
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user