diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-03-15 15:31:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-15 15:31:55 +0100 |
commit | dc6e0c3591709d6f8887bb672af1de54dfc8a974 (patch) | |
tree | 0239d62e419b840f1c4e5cd631a7b87689ed2a3b /core/isolate.rs | |
parent | ec3f44581bf4312cbbe36b71daca7f0474177cf3 (diff) |
feat: Deno.core.{encode,decode}; standalone UTF-8 encoding/decoding (#4349)
This commits add two new methods to "Deno.core" namespace: "encode" and "decode".
Those methods are bound in Rust to provide a) fast b) generally available of encoding and decoding UTF-8 strings.
Both methods are now used in "cli/js/dispatch_json.ts".
Diffstat (limited to 'core/isolate.rs')
-rw-r--r-- | core/isolate.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/core/isolate.rs b/core/isolate.rs index cb4bdaaf4..9efe86c0e 100644 --- a/core/isolate.rs +++ b/core/isolate.rs @@ -1113,6 +1113,20 @@ pub mod tests { } #[test] + fn test_encode_decode() { + run_in_task(|mut cx| { + let (mut isolate, _dispatch_count) = setup(Mode::Async); + js_check(isolate.execute( + "encode_decode_test.js", + include_str!("encode_decode_test.js"), + )); + if let Poll::Ready(Err(_)) = isolate.poll_unpin(&mut cx) { + unreachable!(); + } + }); + } + + #[test] fn will_snapshot() { let snapshot = { let mut isolate = Isolate::new(StartupData::None, true); |