summaryrefslogtreecommitdiff
path: root/test_plugin/tests
diff options
context:
space:
mode:
authorCedric Vangout <mail@cvng.dev>2021-05-08 16:38:18 +0400
committerGitHub <noreply@github.com>2021-05-08 14:38:18 +0200
commita051a7f7bc8dab2a4360c146d08b549cbcf17b8d (patch)
tree07303553cf814c38596b2c486eed8188b7575de4 /test_plugin/tests
parentd5f39fd121b8f997dcfb360828f60cee47322ab3 (diff)
feat(plugin): add tests for plugin args (#10529)
Diffstat (limited to 'test_plugin/tests')
-rw-r--r--test_plugin/tests/integration_tests.rs19
-rw-r--r--test_plugin/tests/test.js6
2 files changed, 21 insertions, 4 deletions
diff --git a/test_plugin/tests/integration_tests.rs b/test_plugin/tests/integration_tests.rs
index 203a8bade..e408f59db 100644
--- a/test_plugin/tests/integration_tests.rs
+++ b/test_plugin/tests/integration_tests.rs
@@ -35,7 +35,24 @@ fn basic() {
}
println!("{:?}", output.status);
assert!(output.status.success());
- let expected = "Plugin rid: 3\nHello from sync plugin op.\nzero_copy: test\nop_test_sync returned: test\nHello from async plugin op.\nzero_copy: 123\nop_test_async returned: test\nHello from resource_table.add plugin op.\nTestResource rid: 4\nHello from resource_table.get plugin op.\nTestResource get value: hello plugin!\nHello from sync plugin op.\nOps completed count is correct!\nOps dispatched count is correct!\n";
+ let expected = "\
+ Plugin rid: 3\n\
+ Hello from sync plugin op.\n\
+ args: TestArgs { val: \"1\" }\n\
+ zero_copy: test\n\
+ op_test_sync returned: test\n\
+ Hello from async plugin op.\n\
+ args: TestArgs { val: \"1\" }\n\
+ zero_copy: 123\n\
+ op_test_async returned: test\n\
+ Hello from resource_table.add plugin op.\n\
+ TestResource rid: 4\n\
+ Hello from resource_table.get plugin op.\n\
+ TestResource get value: hello plugin!\n\
+ Hello from sync plugin op.\n\
+ args: TestArgs { val: \"1\" }\n\
+ Ops completed count is correct!\n\
+ Ops dispatched count is correct!\n";
assert_eq!(stdout, expected);
assert_eq!(stderr, "");
}
diff --git a/test_plugin/tests/test.js b/test_plugin/tests/test.js
index 716b2ff9a..5e0e6d5a4 100644
--- a/test_plugin/tests/test.js
+++ b/test_plugin/tests/test.js
@@ -42,7 +42,7 @@ if (
function runTestSync() {
const result = Deno.core.opSync(
"op_test_sync",
- null,
+ { val: "1" },
new Uint8Array([116, 101, 115, 116]),
);
@@ -56,7 +56,7 @@ function runTestSync() {
async function runTestAsync() {
const promise = Deno.core.opAsync(
"op_test_async",
- null,
+ { val: "1" },
new Uint8Array([49, 50, 51]),
);
@@ -95,7 +95,7 @@ function runTestResourceTable() {
function runTestOpCount() {
const start = Deno.metrics();
- Deno.core.opSync("op_test_sync");
+ Deno.core.opSync("op_test_sync", { val: "1" });
const end = Deno.metrics();