summaryrefslogtreecommitdiff
path: root/cli/ops/testing.rs
diff options
context:
space:
mode:
authorMatt Mastracci <matthew@mastracci.com>2024-02-05 13:26:59 -0700
committerGitHub <noreply@github.com>2024-02-05 20:26:59 +0000
commit2c621f5894b727cff4f2b0e7d045d9b579add3ed (patch)
tree026bceb6b75af64b8d8d3816edc9131775704da9 /cli/ops/testing.rs
parent0a3d329dd82456cd894bda257e01cd50a62d6833 (diff)
refactor(cli): Move op descriptions into Rust and prepare for op import (#22271)
This moves the op sanitizer descriptions into Rust code and prepares for eventual op import from `ext:core/ops`. We cannot import these ops from `ext:core/ops` as the testing infrastructure ops are not always present. Changes: - Op descriptions live in `cli` code and are currently accessible via an op for the older sanitizer code - `phf` dep moved to workspace root so we can use it here - `ops.op_XXX` changed to to `op_XXX` to prepare for op imports later on.
Diffstat (limited to 'cli/ops/testing.rs')
-rw-r--r--cli/ops/testing.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/cli/ops/testing.rs b/cli/ops/testing.rs
index 4a2f48181..7bf0b37a3 100644
--- a/cli/ops/testing.rs
+++ b/cli/ops/testing.rs
@@ -1,5 +1,6 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
+use crate::tools::test::fmt::OP_DETAILS;
use crate::tools::test::TestDescription;
use crate::tools::test::TestEvent;
use crate::tools::test::TestEventSender;
@@ -47,6 +48,7 @@ deno_core::extension!(deno_test,
op_test_op_sanitizer_collect,
op_test_op_sanitizer_finish,
op_test_op_sanitizer_report,
+ op_test_op_sanitizer_get_async_message,
],
options = {
sender: TestEventSender,
@@ -420,3 +422,15 @@ fn op_test_op_sanitizer_report(
))),
}
}
+
+#[op2]
+#[serde]
+fn op_test_op_sanitizer_get_async_message(
+ #[string] op_name: &str,
+) -> (String, Option<String>) {
+ if let Some(output) = OP_DETAILS.get(op_name) {
+ (output[0].to_string(), Some(output[1].to_string()))
+ } else {
+ (op_name.to_string(), None)
+ }
+}