Skip to content

Add test blocks and run them in the snapshot tests - #231

Merged
SpaceManiac merged 19 commits into
mainfrom
tad/test-blocks
Sep 17, 2026
Merged

SpaceManiac merged 19 commits into
mainfrom
tad/test-blocks

Conversation

@SpaceManiac

Copy link
Copy Markdown
Contributor

The runtime is now connected to the snapshot tests! 🎉

test blocks have an optional string literal description and a block. They accept no parameters and return unit. They are compiled to functions with arbitrary names and an @external-id("starstream:test:<...>") annotation. Currently these functions are in the same .wasm file, but in the future when cross-contract calls are supported they should be moved to a .test.wasm output to avoid polluting the main contract .wasm.

The multifile test cases are also now included in the snapshot suite, with a simplified output since they'll tend to be pretty big otherwise.

Also improves ModuleGraph and related functionality in the compiler to partially prepare for a cross-contract-call future.

Signed-off-by: Tad Hardesty <tad.hardesty@midnight.foundation>
Signed-off-by: Tad Hardesty <tad.hardesty@midnight.foundation>
Signed-off-by: Tad Hardesty <tad.hardesty@midnight.foundation>
Signed-off-by: Tad Hardesty <tad.hardesty@midnight.foundation>
Signed-off-by: Tad Hardesty <tad.hardesty@midnight.foundation>
Signed-off-by: Tad Hardesty <tad.hardesty@midnight.foundation>
Signed-off-by: Tad Hardesty <tad.hardesty@midnight.foundation>
Signed-off-by: Tad Hardesty <tad.hardesty@midnight.foundation>
Signed-off-by: Tad Hardesty <tad.hardesty@midnight.foundation>
Signed-off-by: Tad Hardesty <tad.hardesty@midnight.foundation>
Signed-off-by: Tad Hardesty <tad.hardesty@midnight.foundation>
Signed-off-by: Tad Hardesty <tad.hardesty@midnight.foundation>
Signed-off-by: Tad Hardesty <tad.hardesty@midnight.foundation>
Signed-off-by: Tad Hardesty <tad.hardesty@midnight.foundation>
Signed-off-by: Tad Hardesty <tad.hardesty@midnight.foundation>
Signed-off-by: Tad Hardesty <tad.hardesty@midnight.foundation>
Signed-off-by: Tad Hardesty <tad.hardesty@midnight.foundation>
Signed-off-by: Tad Hardesty <tad.hardesty@midnight.foundation>
Signed-off-by: Tad Hardesty <tad.hardesty@midnight.foundation>
use wasmprinter::Print;
use wasmtime::component::Component;

#[path = "../../starstream-runtime-next/tests/common/mod.rs"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I try to use it sparingly...

@SpaceManiac SpaceManiac changed the title Add test block support and run them in the snapshot tests Add test blocks and run them in the snapshot tests Sep 17, 2026
@SpaceManiac
SpaceManiac merged commit 42ef4ed into main Sep 17, 2026
7 checks passed
@SpaceManiac
SpaceManiac deleted the tad/test-blocks branch September 17, 2026 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants