diff --git a/crates/cli/benches/benchmark.rs b/crates/cli/benches/benchmark.rs index 4f77fa6d..3debc827 100644 --- a/crates/cli/benches/benchmark.rs +++ b/crates/cli/benches/benchmark.rs @@ -136,6 +136,15 @@ pub fn criterion_benchmark(c: &mut Criterion) { let mut function_cases = vec![]; for linking in [Linking::Static, Linking::Dynamic] { for compilation in [Compilation::JustInTime, Compilation::AheadOfTime] { + function_cases.push( + FunctionCase::new( + Path::new("benches/functions/empty"), + Path::new("index.js"), + &compilation, + linking, + ) + .unwrap(), + ); function_cases.push( FunctionCase::new( Path::new("benches/functions/simple_discount"), @@ -182,13 +191,14 @@ pub fn criterion_benchmark(c: &mut Criterion) { fn execute_javy(index_js: &Path, wasm: &Path, linking: &Linking) -> Result<()> { let mut args = vec![ - "compile", + "build", index_js.to_str().unwrap(), "-o", wasm.to_str().unwrap(), ]; if let Linking::Dynamic = linking { - args.push("-d"); + args.push("-C"); + args.push("dynamic"); } let status_code = Command::new(Path::new("../../target/release/javy").to_str().unwrap()) .args(args) diff --git a/crates/cli/benches/functions/empty/index.js b/crates/cli/benches/functions/empty/index.js new file mode 100644 index 00000000..e69de29b diff --git a/crates/cli/benches/functions/empty/input.json b/crates/cli/benches/functions/empty/input.json new file mode 100644 index 00000000..e69de29b diff --git a/crates/cli/tests/integration_test.rs b/crates/cli/tests/integration_test.rs index 5b4b3499..62aedc8c 100644 --- a/crates/cli/tests/integration_test.rs +++ b/crates/cli/tests/integration_test.rs @@ -6,6 +6,15 @@ use wasmtime::{AsContextMut, Engine, Linker, Module, Store}; use javy_test_macros::javy_cli_test; +#[javy_cli_test] +fn test_empty(builder: &mut Builder) -> Result<()> { + let mut runner = builder.input("empty.js").build()?; + + let (_, _, fuel_consumed) = run(&mut runner, &[]); + assert_fuel_consumed_within_threshold(22_590, fuel_consumed); + Ok(()) +} + #[javy_cli_test] fn test_identity(builder: &mut Builder) -> Result<()> { let mut runner = builder.build()?; diff --git a/crates/cli/tests/sample-scripts/empty.js b/crates/cli/tests/sample-scripts/empty.js new file mode 100644 index 00000000..e69de29b