Skip to content

Commit

Permalink
Add sanity tests
Browse files Browse the repository at this point in the history
  • Loading branch information
saulecabrera committed Sep 18, 2024
1 parent c76ea9d commit 17ae165
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
17 changes: 17 additions & 0 deletions crates/cli/src/codegen/dynamic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,3 +304,20 @@ fn print_wat(wasm_binary: &[u8]) -> Result<()> {
fn print_wat(_wasm_binary: &[u8]) -> Result<()> {
Ok(())
}

#[cfg(test)]
mod test {
use super::DynamicGenerator;
use super::WitOptions;
use anyhow::Result;

#[test]
fn default_values() -> Result<()> {
let gen = DynamicGenerator::new();
assert!(gen.source_compression);
assert_eq!(gen.import_namespace, "");
assert_eq!(gen.wit_opts, WitOptions::default());

Ok(())
}
}
17 changes: 17 additions & 0 deletions crates/cli/src/codegen/static.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,20 @@ fn optimize_wasm(wasm: &[u8]) -> Result<Vec<u8>> {

Ok(fs::read(&tempfile_path)?)
}

#[cfg(test)]
mod test {
use super::StaticGenerator;
use super::WitOptions;
use anyhow::Result;
use javy_config::Config;

#[test]
fn default_values() -> Result<()> {
let gen = StaticGenerator::new(Config::default());
assert!(gen.source_compression);
assert_eq!(gen.wit_opts, WitOptions::default());

Ok(())
}
}

0 comments on commit 17ae165

Please sign in to comment.