17 Star 56 Fork 8

深度社区/unilang

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
test.sh 1.01 KB
一键复制 编辑 原始数据 按行查看 历史
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2020-2023 UnionTech Software Technology Co.,Ltd.
# shellcheck disable=2016
set -e
OUT=/tmp/out
ERR=/tmp/err
touch "$OUT"
touch "$ERR"
: "${UNILANG:=./unilang}"
if test -d "$UNILANG" || test ! -x "$UNILANG"; then
echo "ERROR: Wrong '$UNILANG' found as the interpreter."
exit 1
fi
call_intp()
{
set +e
echo > "$ERR"
# echo "$1" | "$UNILANG" 1> "$OUT" 2> "$ERR"
"$UNILANG" -e "$1" 1> "$OUT" 2> "$ERR"
set -e
}
# NOTE: Test cases should print no errors.
run_case()
{
echo "Running case:" "$1"
if ! (call_intp "$1") || test -s "$ERR"; then
echo "FAIL."
echo "Error:"
cat "$ERR"
else
echo "PASS."
fi
}
if test -n "$PTC"; then
# NOTE: Test cases should print no errors.
echo "The following case are expected to be non-terminating."
echo "However, the maximum memory consumption is expected constant."
echo "Please exit manually by SIGINT."
run_case '$defl! f (n) $if #t (f n); f 1'
fi
# Sanity.
run_case 'display'
# Documented examples.
run_case 'load "test.txt"'
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/linuxdeepin/unilang.git
git@gitee.com:linuxdeepin/unilang.git
linuxdeepin
unilang
unilang
master

搜索帮助