-
Notifications
You must be signed in to change notification settings - Fork 3
Supply default function #9
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
HerrCai0907
merged 15 commits into
wasm-ecosystem:main
from
xpirad:supply_default_function
Feb 20, 2025
Merged
Changes from 10 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
a9d3c4d
supply default function
meowbmw 1fcf4fb
lint ignore
meowbmw b137251
lint fix
meowbmw 91781c2
add eslint-disable-next-line @typescript-eslint/no-unsafe-member-acce…
meowbmw 445252a
remove empty default.ts
meowbmw a6525fa
move default.test.ts to ts/e2e
meowbmw f21211d
fix path in prettierignore
meowbmw e663d82
Merge remote-tracking branch 'upstream/main' into supply_default_func…
meowbmw 8d7a6a0
address pr reviews
meowbmw 8663dce
delete unused tsconfig
meowbmw f38a724
rewrite default test and refactor
meowbmw 0a371f5
lint
meowbmw 00e67ef
fix lint
meowbmw 63e5501
address pr comments
meowbmw eb7aab1
add test non function type will not be injected
meowbmw 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 |
---|---|---|
|
@@ -6,5 +6,6 @@ | |
/tests/ts/fixture | ||
/third_party | ||
/tests/cpp/lit/**/*.json | ||
/tests/as/default.test.ts | ||
/.cache | ||
/.github/CODEOWNERS |
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
xpirad marked this conversation as resolved.
Show resolved
Hide resolved
|
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,47 @@ | ||
import { describe, test, expect, endTest } from "../../assembly"; | ||
|
||
// Default Stub Injection Tests | ||
// Making sure that external functions can supplied with an empty default function so that users will be free of supplying their own | ||
|
||
@external("myenv", "processEvent") | ||
declare function processEvent(eventId: i32): void; | ||
|
||
@external("externalMath", "add") | ||
declare function add(a: i32, b: i32): i32; | ||
|
||
@external("system", "getStatus") | ||
declare function getStatus(): i32; | ||
|
||
@external("logger", "logWarning") | ||
declare function logWarning(messageId: i32): i32; | ||
|
||
@external("customOps", "combineValues") | ||
declare function combineValues(a: i32, b: f32, c: i64): i32; | ||
|
||
describe("Default Stub Injection Tests", () => { | ||
test("Test processEvent (i32) -> void", () => { | ||
processEvent(101); | ||
}); | ||
|
||
test("Test add (i32, i32) -> i32", () => { | ||
const result = add(10, 5); | ||
expect(result).equal(0); | ||
}); | ||
|
||
test("Test getStatus () -> i32", () => { | ||
const result = getStatus(); | ||
expect(result).equal(0); | ||
}); | ||
|
||
test("Test logWarning (i32) -> i32", () => { | ||
const result = logWarning(12345); | ||
expect(result).equal(0); | ||
}); | ||
|
||
test("Test combineValues (i32, f32, i64) -> i32", () => { | ||
const result = combineValues(1, 2.5, 1000); | ||
expect(result).equal(0); | ||
}); | ||
}); | ||
|
||
endTest(); |
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.
Uh oh!
There was an error while loading. Please reload this page.