From 041ccb6a0d658a7ba393b2cfe86579b2dc4945b7 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Wed, 3 Jun 2020 10:06:34 -0400 Subject: [PATCH] Remove dead code (#6066) --- core/es_isolate.rs | 88 ---------------------------------------------- 1 file changed, 88 deletions(-) diff --git a/core/es_isolate.rs b/core/es_isolate.rs index 35cf177f84..f8770db4db 100644 --- a/core/es_isolate.rs +++ b/core/es_isolate.rs @@ -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, - } - - impl ModuleLoader for DynImportErr2Loader { - fn resolve( - &self, - specifier: &str, - referrer: &str, - _is_main: bool, - _is_dyn_import: bool, - ) -> Result { - 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, - ) -> Pin> { - 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] fn dyn_import_ok() { #[derive(Clone, Default)]