summaryrefslogtreecommitdiff
path: root/ops/tests
diff options
context:
space:
mode:
authorDivy Srivastava <dj.srivastava23@gmail.com>2022-08-21 17:37:53 +0530
committerGitHub <noreply@github.com>2022-08-21 17:37:53 +0530
commit906aa78af33c8405a47d5446d2a6fb3348c275bb (patch)
treec444e42b6bdfe4bad35634925829a1b1d190fa75 /ops/tests
parente39d4e3e7fb9815bf094e7321d1d73d00275831a (diff)
feat(ops): V8 Fast Calls (#15291)
Diffstat (limited to 'ops/tests')
-rw-r--r--ops/tests/compile_fail/unsupported.rs27
-rw-r--r--ops/tests/compile_fail/unsupported.stderr31
-rw-r--r--ops/tests/mod.rs5
3 files changed, 63 insertions, 0 deletions
diff --git a/ops/tests/compile_fail/unsupported.rs b/ops/tests/compile_fail/unsupported.rs
new file mode 100644
index 000000000..1c4d6407a
--- /dev/null
+++ b/ops/tests/compile_fail/unsupported.rs
@@ -0,0 +1,27 @@
+// Copyright 2019-2020 the Deno authors. All rights reserved. MIT license.
+
+use deno_ops::op;
+
+#[op(fast)]
+fn op_result_return(a: i32, b: i32) -> Result<(), ()> {
+ a + b
+}
+
+#[op(fast)]
+fn op_u8_arg(a: u8, b: u8) {
+ //
+}
+
+#[op(fast)]
+fn op_u16_arg(a: u16, b: u16) {
+ //
+}
+
+#[op(fast)]
+async fn op_async_fn(a: i32, b: i32) -> i32 {
+ a + b
+}
+
+fn main() {
+ // pass
+}
diff --git a/ops/tests/compile_fail/unsupported.stderr b/ops/tests/compile_fail/unsupported.stderr
new file mode 100644
index 000000000..68c9f7f16
--- /dev/null
+++ b/ops/tests/compile_fail/unsupported.stderr
@@ -0,0 +1,31 @@
+error: custom attribute panicked
+ --> tests/compile_fail/unsupported.rs:5:1
+ |
+5 | #[op(fast)]
+ | ^^^^^^^^^^^
+ |
+ = help: message: op cannot be a fast api. enforced by #[op(fast)]
+
+error: custom attribute panicked
+ --> tests/compile_fail/unsupported.rs:10:1
+ |
+10 | #[op(fast)]
+ | ^^^^^^^^^^^
+ |
+ = help: message: op cannot be a fast api. enforced by #[op(fast)]
+
+error: custom attribute panicked
+ --> tests/compile_fail/unsupported.rs:15:1
+ |
+15 | #[op(fast)]
+ | ^^^^^^^^^^^
+ |
+ = help: message: op cannot be a fast api. enforced by #[op(fast)]
+
+error: custom attribute panicked
+ --> tests/compile_fail/unsupported.rs:20:1
+ |
+20 | #[op(fast)]
+ | ^^^^^^^^^^^
+ |
+ = help: message: async op cannot be a fast api. enforced by #[op(fast)]
diff --git a/ops/tests/mod.rs b/ops/tests/mod.rs
new file mode 100644
index 000000000..522647f51
--- /dev/null
+++ b/ops/tests/mod.rs
@@ -0,0 +1,5 @@
+#[test]
+fn op_macro() {
+ let t = trybuild::TestCases::new();
+ t.compile_fail("tests/compile_fail/*.rs");
+}