-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework component testing support to make test updates easier (#395)
Add a macro for generating the core wasm and component versions of a test, and modify the .adapt_component builder function on Test to accept a bool. This simplifies modifying existing tests to support components by doing the work of abstracting out the body in a macro.
- Loading branch information
Showing
4 changed files
with
40 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,16 @@ | ||
use { | ||
crate::common::{Test, TestResult}, | ||
crate::{ | ||
common::{Test, TestResult}, | ||
viceroy_test, | ||
}, | ||
hyper::StatusCode, | ||
}; | ||
|
||
#[tokio::test(flavor = "multi_thread")] | ||
async fn request_works() -> TestResult { | ||
let resp = Test::using_fixture("request.wasm").against_empty().await?; | ||
assert_eq!(resp.status(), StatusCode::OK); | ||
Ok(()) | ||
} | ||
|
||
#[tokio::test(flavor = "multi_thread")] | ||
async fn request_works_component() -> TestResult { | ||
viceroy_test!(request_works, |is_component| { | ||
let resp = Test::using_fixture("request.wasm") | ||
.adapt_component() | ||
.adapt_component(is_component) | ||
.against_empty() | ||
.await?; | ||
assert_eq!(resp.status(), StatusCode::OK); | ||
Ok(()) | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,16 @@ | ||
use { | ||
crate::common::{Test, TestResult}, | ||
crate::{ | ||
common::{Test, TestResult}, | ||
viceroy_test, | ||
}, | ||
hyper::StatusCode, | ||
}; | ||
|
||
#[tokio::test(flavor = "multi_thread")] | ||
async fn response_works() -> TestResult { | ||
let resp = Test::using_fixture("response.wasm").against_empty().await?; | ||
assert_eq!(resp.status(), StatusCode::OK); | ||
Ok(()) | ||
} | ||
|
||
#[tokio::test(flavor = "multi_thread")] | ||
async fn response_works_component() -> TestResult { | ||
viceroy_test!(response_works, |is_component| { | ||
let resp = Test::using_fixture("response.wasm") | ||
.adapt_component() | ||
.adapt_component(is_component) | ||
.against_empty() | ||
.await?; | ||
assert_eq!(resp.status(), StatusCode::OK); | ||
Ok(()) | ||
} | ||
}); |