1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 07:14:47 -05:00

fix(ops): circular dependency in deno_ops test (#16809)

This commit is contained in:
Divy Srivastava 2022-11-25 06:47:21 -08:00 committed by GitHub
parent d80af8324d
commit 8fc62f93bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 6 additions and 74 deletions

1
Cargo.lock generated
View file

@ -1160,7 +1160,6 @@ dependencies = [
name = "deno_ops"
version = "0.39.0"
dependencies = [
"deno_core",
"once_cell",
"pmutil",
"prettyplease",

View file

@ -24,7 +24,6 @@ regex.workspace = true
syn.workspace = true
[dev-dependencies]
deno_core.workspace = true
prettyplease = "0.1.21"
testing_macros = "0.2.7"
trybuild = "1.0.71"

View file

@ -1,4 +1,5 @@
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
#![cfg(not(test))]
use proc_macro2::{Span, TokenStream};
use proc_macro_crate::{crate_name, FoundCrate};

View file

@ -432,7 +432,7 @@ mod tests {
#[testing_macros::fixture("optimizer_tests/**/*.rs")]
fn test_fast_call_codegen(input: PathBuf) {
let update_expected = std::env::var("UPDATE_EXPECTED").is_ok();
let core = crate::deno::import();
let core = quote!(deno_core);
let source =
std::fs::read_to_string(&input).expect("Failed to read test file");

View file

@ -17,9 +17,6 @@ mod deno;
mod fast_call;
mod optimizer;
#[cfg(test)]
mod tests;
const SCOPE_LIFETIME: &str = "'scope";
/// Add the 'scope lifetime to the function signature.
@ -60,6 +57,10 @@ impl Op {
let is_async = item.sig.asyncness.is_some() || is_future(&item.sig.output);
let type_params = exclude_lifetime_params(&item.sig.generics.params);
#[cfg(test)]
let core = quote!(deno_core);
#[cfg(not(test))]
let core = deno::import();
Self {

View file

@ -1,11 +0,0 @@
use deno_core::v8::fast_api::FastApiCallbackOptions;
use deno_ops::op;
#[op(fast)]
fn op_fallback(options: Option<&mut FastApiCallbackOptions>) {
if let Some(options) = options {
options.fallback = true;
}
}
fn main() {}

View file

@ -1,29 +0,0 @@
// Copyright 2019-2020 the Deno authors. All rights reserved. MIT license.
use deno_ops::op;
#[op(fast)]
fn op_u8_arg(a: u8, b: u8) {
//
}
#[op(fast)]
fn op_u16_arg(a: u16, b: u16) {
//
}
use deno_core::v8::fast_api::FastApiCallbackOptions;
#[op(fast)]
fn op_callback_options(options: &mut FastApiCallbackOptions) {
// fast callback options must be an Option.
}
#[op(fast)]
async fn op_async_fn(a: i32, b: i32) -> i32 {
a + b
}
fn main() {
// pass
}

View file

@ -1,22 +0,0 @@
error[E0277]: the trait bound `&mut FastApiCallbackOptions<'_>: Deserialize<'_>` is not satisfied
--> tests/compile_fail/unsupported.rs:17:1
|
17 | #[op(fast)]
| ^^^^^^^^^^^ the trait `Deserialize<'_>` is not implemented for `&mut FastApiCallbackOptions<'_>`
|
= help: the following other types implement trait `Deserialize<'de>`:
&'a Path
&'a [u8]
&'a str
()
(T0, T1)
(T0, T1, T2)
(T0, T1, T2, T3)
(T0, T1, T2, T3, T4)
and 143 others
note: required by a bound in `from_v8`
--> $WORKSPACE/serde_v8/de.rs
|
| T: Deserialize<'de>,
| ^^^^^^^^^^^^^^^^ required by this bound in `from_v8`
= note: this error originates in the attribute macro `op` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -1,6 +0,0 @@
#[test]
fn op_macro() {
let t = trybuild::TestCases::new();
t.compile_fail("tests/compile_fail/*.rs");
t.pass("tests/01_fast_callback_options.rs");
}