test: cli 测试直调编译产物二进制,脱离 cargo run 递归

This commit is contained in:
2026-08-16 15:02:04 +08:00
parent 7e180d9ac1
commit f416f49113
2 changed files with 10 additions and 10 deletions
+2 -2
View File
@@ -1,8 +1,8 @@
use std::process::Command; use std::process::Command;
fn run_eval(js: &str) -> std::process::Output { fn run_eval(js: &str) -> std::process::Output {
Command::new("cargo") Command::new(env!("CARGO_BIN_EXE_oxide"))
.args(["run", "--", "eval", js]) .args(["eval", js])
.output() .output()
.expect("failed to run oxide eval") .expect("failed to run oxide eval")
} }
+8 -8
View File
@@ -2,8 +2,8 @@ use std::process::Command;
#[test] #[test]
fn eval_simple_expression() { fn eval_simple_expression() {
let output = Command::new("cargo") let output = Command::new(env!("CARGO_BIN_EXE_oxide"))
.args(["run", "--", "eval", "1 + 2"]) .args(["eval", "1 + 2"])
.output() .output()
.expect("failed to run oxide eval"); .expect("failed to run oxide eval");
@@ -14,8 +14,8 @@ fn eval_simple_expression() {
#[test] #[test]
fn eval_syntax_error() { fn eval_syntax_error() {
let output = Command::new("cargo") let output = Command::new(env!("CARGO_BIN_EXE_oxide"))
.args(["run", "--", "eval", "function("]) .args(["eval", "function("])
.output() .output()
.expect("failed to run oxide eval"); .expect("failed to run oxide eval");
@@ -27,8 +27,8 @@ fn eval_syntax_error() {
#[test] #[test]
fn run_file() { fn run_file() {
let fixture = concat!(env!("CARGO_MANIFEST_DIR"), "/tests/fixtures/hello.js"); let fixture = concat!(env!("CARGO_MANIFEST_DIR"), "/tests/fixtures/hello.js");
let output = Command::new("cargo") let output = Command::new(env!("CARGO_BIN_EXE_oxide"))
.args(["run", "--", "run", fixture]) .args(["run", fixture])
.output() .output()
.expect("failed to run oxide run"); .expect("failed to run oxide run");
@@ -39,8 +39,8 @@ fn run_file() {
#[test] #[test]
fn bench_help() { fn bench_help() {
let output = Command::new("cargo") let output = Command::new(env!("CARGO_BIN_EXE_oxide"))
.args(["run", "--", "bench", "--help"]) .args(["bench", "--help"])
.output() .output()
.expect("failed to run oxide bench --help"); .expect("failed to run oxide bench --help");