Files
ziran/tests/path.sh
T
waozi da76a21675 Remove the C++, Rust and Plan 9 targets
Ziran now generates C, Go, Python and portable .zx. zi2cpp, zi2rust, the
C++ mode of the shared C emitter, the Plan 9 post-pass and the std Plan 9
modules are gone; --target=cpp|rust|plan9-c and zi2c --plan9 are rejected
as unknown targets. Generated C headers keep avoiding C++ keywords in
exported names, so C++ hosts can still include them.
2026-10-24 00:57:29 -03:00

28 lines
1.1 KiB
Bash

#!/bin/sh
set -eu
ziran=${1:?pass the ziran command}
work=$(mktemp -d)
trap 'rm -rf "$work"' EXIT HUP INT TERM
unset DISPLAY WAYLAND_DISPLAY
"$ziran" ir --root tests/spec --module-path std -o "$work/ir" tests/spec/path_test.zi
for mode in source saved; do
root=tests/spec
input=tests/spec/path_test.zi
if test "$mode" = saved; then root=$work/ir; input=$root/path_test.zir; fi
"$ziran" bundle --root "$root" --module-path std --entry path_test:main -o "$work/$mode.zx" "$input"
test "$("$ziran" run "$work/$mode.zx")" = 0
for target in c go; do
out=$work/$mode-$target
if test "$target" = go; then
"$ziran" build --target=go --pkg main --exe --entry path_test:main --root "$root" --module-path std -o "$out" "$input"
else
"$ziran" build --target="$target" --root "$root" --module-path std -o "$out" "$input"
fi
case "$target" in
c) cc -std=c11 -I"$out" "$out"/*.c -o "$out/run"; "$out/run" ;;
go) (cd "$out" && GO111MODULE=off go run .) ;;
esac
done
done
echo 'path: source, saved IR, C, Go, and VM passed'