fix(test_plugin): Add README.md and make function use same data (#9128)

This commit is contained in:
linbingquan 2021-01-26 22:20:26 +08:00 committed by GitHub
parent 06bd692e5c
commit eb30c6f510
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 4 deletions

9
test_plugin/README.md Normal file
View file

@ -0,0 +1,9 @@
# `test_plugin` crate
## To run this test manually
```
cd test_plugin
../target/debug/deno run --unstable --allow-plugin tests/test.js debug
```

View file

@ -1,7 +1,4 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
// To run this test manually:
// cd test_plugin
// ../target/debug/deno run --unstable --allow-plugin tests/test.js debug
use std::process::Command;
use test_util::deno_cmd;
@ -37,7 +34,7 @@ fn basic() {
println!("stderr {}", stderr);
}
assert!(output.status.success());
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";
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\nzero_copy[2]: cba\nPlugin Async Response: test\n";
assert_eq!(stdout, expected);
assert_eq!(stderr, "");
}

View file

@ -53,6 +53,7 @@ function runTestAsync() {
testAsync,
new Uint8Array([116, 101, 115, 116]),
new Uint8Array([49, 50, 51]),
new Uint8Array([99, 98, 97]),
);
if (response != null || response != undefined) {