-
Notifications
You must be signed in to change notification settings - Fork 19
Add wstd::main and wstd::test macros for WASIp3
#149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
pchickey
merged 34 commits into
bytecodealliance:main
from
adamrk:abk/main-macro-for-wasip3
Sep 15, 2026
+35
−4
Merged
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
42d7884
add p3 feature
adamrk 4a6e65c
add p3 test CI job
adamrk ea32edf
use cfg alias
adamrk 0487755
Require `&mut` for Streams
adamrk 443ef72
remove &self stream methods
adamrk cabda1f
Add `wstd::main` and `wstd::test` macros for WASIp3
adamrk adb35fc
switch from feature to target
adamrk 7e37d58
Merge branch 'main' into abk/p3-feature-base
adamrk 26bea8b
merge fixes
adamrk 6435d57
add job printing rust version
adamrk 663c532
try override instead of default
adamrk d306e06
explicitly add wasi targets
adamrk 2f8c1c2
bump msrv to latest version with p3 target_env
adamrk 5841233
include target_os in directives
adamrk d880934
Merge branch 'abk/p3-feature-base' into abk/shared-ref-changes
adamrk 47b889b
Merge branch 'abk/shared-ref-changes' into abk/main-macro-for-wasip3
adamrk 114abd0
fixes from merge
adamrk 9d58000
use wit_bindgen::block_on in macros
adamrk 14e1bce
remove build-std
adamrk 2adec58
remove dead code
adamrk 6150b98
no main for non-wasi targets
adamrk d8994a6
Merge branch 'abk/p3-feature-base' into abk/shared-ref-changes
adamrk 2c7a618
Merge branch 'abk/shared-ref-changes' into abk/main-macro-for-wasip3
adamrk 64f20f5
change block_on static requirement
adamrk c3a377c
cleanup Cargo.tomls after feature removal
adamrk fb62b45
cleanup Cargo.tomls after feature removal
adamrk d3826e3
Merge branch 'abk/p3-feature-base' into abk/shared-ref-changes
adamrk d4fd717
Merge branch 'abk/shared-ref-changes' into abk/main-macro-for-wasip3
adamrk fdb266c
keep http macro only in p2
adamrk 1572e34
Merge branch 'main' into abk/shared-ref-changes
adamrk 059432a
Merge branch 'abk/shared-ref-changes' into abk/main-macro-for-wasip3
adamrk cf4ffae
Merge branch 'main' into abk/main-macro-for-wasip3
adamrk 66b1834
remove old no_main
adamrk ed8b70b
Revert "remove old no_main"
adamrk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| #![cfg_attr(not(target_os = "wasi"), no_main)] | ||
| #![cfg(target_os = "wasi")] | ||
|
|
||
| //! Verifies that the `main` macro is compiling. | ||
|
|
||
| #[wstd::main] | ||
| async fn main() { | ||
| println!("Hello world"); | ||
| } | ||
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -2,7 +2,7 @@ | |
|
|
||
| use wstd::http::{Body, Client, Request, error::ErrorCode}; | ||
|
|
||
| #[wstd::main] | ||
| #[wstd::test] | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A drive-by fix. This test wasn't actually running under |
||
| async fn main() -> Result<(), Box<dyn std::error::Error>> { | ||
| // Set first byte timeout to 1/2 second. | ||
| let mut client = Client::new(); | ||
|
|
||
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| // Verify that the test macro is acutally running. | ||
|
|
||
| #[wstd::test] | ||
| async fn computation() -> Result<(), String> { | ||
| assert_eq!(1 + 1, 2); | ||
| Ok(()) | ||
| } | ||
|
|
||
| #[wstd::test] | ||
| async fn second_computation() { | ||
| assert_eq!(1 + 1, 2); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious why there is the cfg_attr that is then contradicted by the cfg below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops I think that's just left over from using features. There are some other cases which I'll also fix in a separate PR.