diff options
Diffstat (limited to 'test_plugin')
| -rw-r--r-- | test_plugin/src/lib.rs | 12 | ||||
| -rw-r--r-- | test_plugin/tests/integration_tests.rs | 2 | ||||
| -rw-r--r-- | test_plugin/tests/test.js | 4 |
3 files changed, 6 insertions, 12 deletions
diff --git a/test_plugin/src/lib.rs b/test_plugin/src/lib.rs index 781bc4259..bb4c4d8ff 100644 --- a/test_plugin/src/lib.rs +++ b/test_plugin/src/lib.rs @@ -12,14 +12,12 @@ pub fn deno_plugin_init(interface: &mut dyn Interface) { fn op_test_sync( _interface: &mut dyn Interface, - data: &[u8], zero_copy: &mut [ZeroCopyBuf], ) -> Op { - let data_str = std::str::from_utf8(&data[..]).unwrap(); - let zero_copy = zero_copy.to_vec(); if !zero_copy.is_empty() { - println!("Hello from plugin. data: {}", data_str); + println!("Hello from plugin."); } + let zero_copy = zero_copy.to_vec(); for (idx, buf) in zero_copy.iter().enumerate() { let buf_str = std::str::from_utf8(&buf[..]).unwrap(); println!("zero_copy[{}]: {}", idx, buf_str); @@ -31,14 +29,12 @@ fn op_test_sync( fn op_test_async( _interface: &mut dyn Interface, - data: &[u8], zero_copy: &mut [ZeroCopyBuf], ) -> Op { - let zero_copy = zero_copy.to_vec(); if !zero_copy.is_empty() { - let data_str = std::str::from_utf8(&data[..]).unwrap().to_string(); - println!("Hello from plugin. data: {}", data_str); + println!("Hello from plugin."); } + let zero_copy = zero_copy.to_vec(); let fut = async move { for (idx, buf) in zero_copy.iter().enumerate() { let buf_str = std::str::from_utf8(&buf[..]).unwrap(); diff --git a/test_plugin/tests/integration_tests.rs b/test_plugin/tests/integration_tests.rs index 53d1c2441..85374c217 100644 --- a/test_plugin/tests/integration_tests.rs +++ b/test_plugin/tests/integration_tests.rs @@ -36,7 +36,7 @@ fn basic() { println!("stderr {}", stderr); } assert!(output.status.success()); - let expected = "Hello from plugin. data: test\nzero_copy[0]: test\nzero_copy[1]: 123\nzero_copy[2]: cba\nPlugin Sync Response: test\nHello from plugin. data: test\nzero_copy[0]: test\nzero_copy[1]: 123\nPlugin Async Response: test\n"; + let expected = "Hello from plugin.\nzero_copy[0]: test\nzero_copy[1]: 123\nzero_copy[2]: cba\nPlugin Sync Response: test\nHello from plugin.\nzero_copy[0]: test\nzero_copy[1]: 123\nPlugin Async Response: test\n"; assert_eq!(stdout, expected); assert_eq!(stderr, ""); } diff --git a/test_plugin/tests/test.js b/test_plugin/tests/test.js index fbe58aeb8..d48394b4b 100644 --- a/test_plugin/tests/test.js +++ b/test_plugin/tests/test.js @@ -33,7 +33,6 @@ function runTestSync() { const response = Deno.core.dispatch( testSync, new Uint8Array([116, 101, 115, 116]), - new Uint8Array([116, 101, 115, 116]), new Uint8Array([49, 50, 51]), new Uint8Array([99, 98, 97]) ); @@ -49,7 +48,6 @@ function runTestAsync() { const response = Deno.core.dispatch( testAsync, new Uint8Array([116, 101, 115, 116]), - new Uint8Array([116, 101, 115, 116]), new Uint8Array([49, 50, 51]) ); @@ -61,7 +59,7 @@ function runTestAsync() { function runTestOpCount() { const start = Deno.metrics(); - Deno.core.dispatch(testSync, new Uint8Array([116, 101, 115, 116])); + Deno.core.dispatch(testSync); const end = Deno.metrics(); |
