mirror of
https://github.com/denoland/deno.git
synced 2024-11-22 15:06:54 -05:00
Remove dead code (#6066)
This commit is contained in:
parent
9a97e61b78
commit
041ccb6a0d
1 changed files with 0 additions and 88 deletions
|
@ -837,94 +837,6 @@ pub mod tests {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
// Note from Bert: I do not understand how this part is supposed to pass.
|
|
||||||
// For me all these modules load in parallel and, unless I'm missing
|
|
||||||
// something, that's how it should be. So I disabled the test for now.
|
|
||||||
#[test]
|
|
||||||
fn dyn_import_err2() {
|
|
||||||
#[derive(Clone, Default)]
|
|
||||||
struct DynImportErr2Loader {
|
|
||||||
pub count: Arc<AtomicUsize>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ModuleLoader for DynImportErr2Loader {
|
|
||||||
fn resolve(
|
|
||||||
&self,
|
|
||||||
specifier: &str,
|
|
||||||
referrer: &str,
|
|
||||||
_is_main: bool,
|
|
||||||
_is_dyn_import: bool,
|
|
||||||
) -> Result<ModuleSpecifier, ErrBox> {
|
|
||||||
let c = self.count.fetch_add(1, Ordering::Relaxed);
|
|
||||||
match c {
|
|
||||||
0 => assert_eq!(specifier, "/foo1.js"),
|
|
||||||
1 => assert_eq!(specifier, "/foo2.js"),
|
|
||||||
2 => assert_eq!(specifier, "/foo3.js"),
|
|
||||||
_ => unreachable!(),
|
|
||||||
}
|
|
||||||
assert_eq!(referrer, "file:///dyn_import_error.js");
|
|
||||||
let s = ModuleSpecifier::resolve_import(specifier, referrer).unwrap();
|
|
||||||
Ok(s)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn load(
|
|
||||||
&self,
|
|
||||||
specifier: &ModuleSpecifier,
|
|
||||||
_maybe_referrer: Option<ModuleSpecifier>,
|
|
||||||
) -> Pin<Box<ModuleSourceFuture>> {
|
|
||||||
let info = ModuleSource {
|
|
||||||
module_url_specified: specifier.to_string(),
|
|
||||||
module_url_found: specifier.to_string(),
|
|
||||||
code: "# not valid JS".to_owned(),
|
|
||||||
};
|
|
||||||
async move { Ok(info) }.boxed()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Import multiple modules to demonstrate that after failed dynamic import
|
|
||||||
// another dynamic import can still be run
|
|
||||||
run_in_task(|cx| {
|
|
||||||
let loader = Box::new(DynImportErr2Loader::default());
|
|
||||||
let loader1 = loader.clone();
|
|
||||||
let mut isolate = EsIsolate::new(loader, StartupData::None, false);
|
|
||||||
|
|
||||||
js_check(isolate.execute(
|
|
||||||
"file:///dyn_import_error.js",
|
|
||||||
r#"
|
|
||||||
(async () => {
|
|
||||||
await import("/foo1.js");
|
|
||||||
})();
|
|
||||||
(async () => {
|
|
||||||
await import("/foo2.js");
|
|
||||||
})();
|
|
||||||
(async () => {
|
|
||||||
await import("/foo3.js");
|
|
||||||
})();
|
|
||||||
"#,
|
|
||||||
));
|
|
||||||
|
|
||||||
assert_eq!(loader1.count.load(Ordering::Relaxed), 0);
|
|
||||||
// Now each poll should return error
|
|
||||||
assert!(match isolate.poll_unpin(cx) {
|
|
||||||
Poll::Ready(Err(_)) => true,
|
|
||||||
_ => false,
|
|
||||||
});
|
|
||||||
assert_eq!(loader1.count.load(Ordering::Relaxed), 1);
|
|
||||||
assert!(match isolate.poll_unpin(cx) {
|
|
||||||
Poll::Ready(Err(_)) => true,
|
|
||||||
_ => false,
|
|
||||||
});
|
|
||||||
assert_eq!(loader1.count.load(Ordering::Relaxed), 2);
|
|
||||||
assert!(match isolate.poll_unpin(cx) {
|
|
||||||
Poll::Ready(Err(_)) => true,
|
|
||||||
_ => false,
|
|
||||||
});
|
|
||||||
assert_eq!(loader1.count.load(Ordering::Relaxed), 3);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn dyn_import_ok() {
|
fn dyn_import_ok() {
|
||||||
#[derive(Clone, Default)]
|
#[derive(Clone, Default)]
|
||||||
|
|
Loading…
Reference in a new issue