用perl执行程序员

发布于 2025-01-26 16:23:15 字数 907 浏览 4 评论 0原文

我有一个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脚本或其他语言帮助我执行程序吗?

project_link

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??

project_link

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文