feat: add phase 3 bun_binary bootstrap and tests
Co-authored-by: Eriyc <50216491+Eriyc@users.noreply.github.com>
This commit is contained in:
35
tests/binary_test/BUILD.bazel
Normal file
35
tests/binary_test/BUILD.bazel
Normal file
@@ -0,0 +1,35 @@
|
||||
load("//bun:defs.bzl", "bun_binary")
|
||||
|
||||
bun_binary(
|
||||
name = "hello_js_bin",
|
||||
entry_point = "hello.js",
|
||||
data = ["hello.js"],
|
||||
)
|
||||
|
||||
sh_test(
|
||||
name = "bun_binary_js_test",
|
||||
srcs = ["run_binary.sh"],
|
||||
args = ["$(location :hello_js_bin)", "hello-js"],
|
||||
data = [":hello_js_bin"],
|
||||
target_compatible_with = [
|
||||
"@platforms//cpu:x86_64",
|
||||
"@platforms//os:linux",
|
||||
],
|
||||
)
|
||||
|
||||
bun_binary(
|
||||
name = "hello_ts_bin",
|
||||
entry_point = "hello.ts",
|
||||
data = ["hello.ts"],
|
||||
)
|
||||
|
||||
sh_test(
|
||||
name = "bun_binary_ts_test",
|
||||
srcs = ["run_binary.sh"],
|
||||
args = ["$(location :hello_ts_bin)", "hello-ts"],
|
||||
data = [":hello_ts_bin"],
|
||||
target_compatible_with = [
|
||||
"@platforms//cpu:x86_64",
|
||||
"@platforms//os:linux",
|
||||
],
|
||||
)
|
||||
1
tests/binary_test/hello.js
Normal file
1
tests/binary_test/hello.js
Normal file
@@ -0,0 +1 @@
|
||||
console.log("hello-js");
|
||||
2
tests/binary_test/hello.ts
Normal file
2
tests/binary_test/hello.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
const message: string = "hello-ts";
|
||||
console.log(message);
|
||||
11
tests/binary_test/run_binary.sh
Executable file
11
tests/binary_test/run_binary.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
binary="$1"
|
||||
expected="$2"
|
||||
output="$(${binary})"
|
||||
|
||||
if [[ "${output}" != "${expected}" ]]; then
|
||||
echo "Unexpected output from ${binary}: ${output}" >&2
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user