mirror of
https://github.com/denoland/deno.git
synced 2025-01-10 08:09:06 -05:00
Local filenames starting with 'http' shouldn't be remote. (#1167)
This commit is contained in:
parent
a18e51fd61
commit
98e6366cb5
1 changed files with 17 additions and 1 deletions
|
@ -753,10 +753,26 @@ fn test_resolve_module_6() {
|
|||
assert_eq!(filename, expected_filename);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_resolve_module_7() {
|
||||
let (_temp_dir, deno_dir) = test_setup();
|
||||
|
||||
let module_specifier = "http_test.ts";
|
||||
let containing_file = add_root!("/Users/rld/src/deno_net/");
|
||||
let expected_module_name = add_root!("/Users/rld/src/deno_net/http_test.ts");
|
||||
let expected_filename = add_root!("/Users/rld/src/deno_net/http_test.ts");
|
||||
|
||||
let (module_name, filename) = deno_dir
|
||||
.resolve_module(module_specifier, containing_file)
|
||||
.unwrap();
|
||||
assert_eq!(module_name, expected_module_name);
|
||||
assert_eq!(filename, expected_filename);
|
||||
}
|
||||
|
||||
const ASSET_PREFIX: &str = "/$asset$/";
|
||||
|
||||
fn is_remote(module_name: &str) -> bool {
|
||||
module_name.starts_with("http")
|
||||
module_name.starts_with("http://") || module_name.starts_with("https://")
|
||||
}
|
||||
|
||||
fn parse_local_or_remote(p: &str) -> Result<url::Url, url::ParseError> {
|
||||
|
|
Loading…
Reference in a new issue