Repository navigation
Conversation
`import_contract!` bakes a real on-chain address into a contract, and nothing lives at that address in a sandboxed test `Env`. Add `stellar_registry::testutils::register_import!` (behind a new `testutils` feature), which resolves a name through the same code as `import_contract!` and registers the imported Wasm, or a native mock, at that address with `Env::register_at`. Stellar Asset Contracts are a compile error for now. The new `hello_caller` fixture imports `hello_v1` and tests itself with `register_import!`. It is excluded from the workspace, since it needs seeded cache files to compile; `just test-register-import` seeds them and runs it offline, and CI runs that recipe. Part of #65 Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
The fixture sits outside the workspace, so it does not pick up the workspace's soroban-sdk bump. Co-Authored-By: Claude <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Part of #65
Adds
register_import!(behind a newtestutilsfeature onstellar-registry), a test helper for contracts that useimport_contract!.import_contract!bakes the imported contract's on-chain address in at build time, so a unit test'sEnvhas nothing at that address.register_import!resolves the name the same way and registers the contract there, so contract code needs no#[cfg(test)]switch around the import.SAC names are a compile error for now; support follows in #82. The
hello_callerfixture is excluded from the workspace because it can't compile without seeded cache files;just test-register-importseeds them and runs it in CI.