Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
vyta committed Feb 2, 2024
1 parent f68a0f1 commit 56f33ba
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions tests/runtime/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,23 @@ impl test::options::test::Host for MyImports {
assert!(a.is_none());
Ok(())
}

fn option_none_result(&mut self) -> Result<Option<String>> {
Ok(None)
}
fn option_some_param(&mut self, a: Option<String>) -> Result<()> {

fn option_some_param(&mut self, a: Option<String>) -> Result<()> {
assert_eq!(a, Some("foo".to_string()));
Ok(())
}

fn option_some_result(&mut self) -> Result<Option<String>> {
Ok(Some("foo".to_string()))
}

fn option_roundtrip(&mut self, a: Option<String>) -> Result<Option<String>> {
Ok(a)
}

}

#[test]
Expand All @@ -45,9 +44,15 @@ fn run_test(exports: Options, store: &mut Store<crate::Wasi<MyImports>>) -> Resu
exports.call_test_imports(&mut *store)?;
let exports = exports.test_options_test();
assert!(exports.call_option_none_result(&mut *store)?.is_none());
assert_eq!(exports.call_option_some_result(&mut *store)?, Some("foo".to_string()));
assert_eq!(
exports.call_option_some_result(&mut *store)?,
Some("foo".to_string())
);
exports.call_option_none_param(&mut *store, None)?;
exports.call_option_some_param(&mut *store, Some("foo"))?;
assert_eq!(exports.call_option_roundtrip(&mut *store,Some("foo"))?, Some("foo".to_string()));
assert_eq!(
exports.call_option_roundtrip(&mut *store, Some("foo"))?,
Some("foo".to_string())
);
Ok(())
}

0 comments on commit 56f33ba

Please sign in to comment.