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

adding missing test cases for <unknown> base (#4988)

This commit is contained in:
Thiago Veronezi 2020-04-30 03:10:28 -04:00 committed by GitHub
parent 8ec36681dd
commit 4bc9c18fe9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -213,7 +213,16 @@ mod tests {
#[test] #[test]
fn test_resolve_import() { fn test_resolve_import() {
fn get_path(specifier: &str) -> Url {
let base_path = current_dir().unwrap().join("<unknown>");
let base_url = Url::from_file_path(base_path).unwrap();
base_url.join(specifier).unwrap()
}
let awesome = get_path("/awesome.ts");
let awesome_srv = get_path("/service/awesome.ts");
let tests = vec![ let tests = vec![
("/awesome.ts", "<unknown>", awesome.as_str()),
("/service/awesome.ts", "<unknown>", awesome_srv.as_str()),
( (
"./005_more_imports.ts", "./005_more_imports.ts",
"http://deno.land/core/tests/006_url_imports.ts", "http://deno.land/core/tests/006_url_imports.ts",
@ -292,6 +301,14 @@ mod tests {
use ModuleResolutionError::*; use ModuleResolutionError::*;
let tests = vec![ let tests = vec![
(
"awesome.ts",
"<unknown>",
ImportPrefixMissing(
"awesome.ts".to_string(),
Some("<unknown>".to_string()),
),
),
( (
"005_more_imports.ts", "005_more_imports.ts",
"http://deno.land/core/tests/006_url_imports.ts", "http://deno.land/core/tests/006_url_imports.ts",