用perl执行程序员
我有一个C程序,我必须用Perl和Test ::编写测试::更多。
但是,我的C程序是一个重复。
这是一个简短的示例:
编译
clang main.c -o database.db
./database.db
初始的Amplion
db>
在此中
db> insert 1 guilherme
Execute命令...嗯...这是一个程序运行。
现在,我在Perl中进行了测试,就是这样:
测试是否现在编译确定
ok(&compile(), "Compile is sucess");
sub compile {
my $compile = "clang $SRC_PATH/main.c -o test.db";
system $compile;
return -e "test.db";
}
需要在C中执行程序后发送
system "./test.db"
... parse commands
命令
3 warnings generated.
ok 1 - Compile is sucess
,我 跑步。
有人用perl脚本或其他语言帮助我执行程序吗?
I have a C program, and I must be write tests with Perl and Test::More.
But, my C program is a REPL.
This is a brief example the this running:
COMPILE
clang main.c -o database.db
./database.db
INITIAL APPARENCE
db>
EXECUTE COMMAND IN THIS
db> insert 1 guilherme
... well ... this is a program running.
Now, I have a tests in Perl and it is this:
TEST IF COMPILE OK
ok(&compile(), "Compile is sucess");
sub compile {
my $compile = "clang $SRC_PATH/main.c -o test.db";
system $compile;
return -e "test.db";
}
Now, I needed send commands after executing the program in C.
system "./test.db"
... parse commands
But every time executing program with the perl system ...
the test lock:
3 warnings generated.
ok 1 - Compile is sucess
the first test runed, but the second tests not running.
Somebody help me a execute program REPL in the Perl script or other language??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论