Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
deno
提交
f168597b
D
deno
项目概览
张重言
/
deno
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
deno
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
f168597b
编写于
2月 02, 2020
作者:
L
Luka Hartwig
提交者:
GitHub
2月 02, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove //tests symlink (#3849)
上级
e8df66c1
变更
28
隐藏空白更改
内联
并排
Showing
28 changed file
with
121 addition
and
116 deletion
+121
-116
cli/compilers/ts.rs
cli/compilers/ts.rs
+2
-2
cli/file_fetcher.rs
cli/file_fetcher.rs
+51
-41
cli/installer.rs
cli/installer.rs
+15
-15
cli/js/body_test.ts
cli/js/body_test.ts
+2
-2
cli/js/compiler_util.ts
cli/js/compiler_util.ts
+1
-1
cli/js/fetch_test.ts
cli/js/fetch_test.ts
+5
-5
cli/js/files_test.ts
cli/js/files_test.ts
+8
-8
cli/js/read_dir_test.ts
cli/js/read_dir_test.ts
+3
-3
cli/js/resources_test.ts
cli/js/resources_test.ts
+1
-1
cli/js/stat_test.ts
cli/js/stat_test.ts
+2
-2
cli/source_maps.rs
cli/source_maps.rs
+2
-2
cli/tests/README.md
cli/tests/README.md
+0
-4
cli/tests/error_003_typescript.ts.out
cli/tests/error_003_typescript.ts.out
+1
-1
cli/tests/error_015_dynamic_import_permissions.js
cli/tests/error_015_dynamic_import_permissions.js
+1
-1
cli/tests/error_015_dynamic_import_permissions.out
cli/tests/error_015_dynamic_import_permissions.out
+1
-1
cli/tests/error_016_dynamic_import_permissions2.js
cli/tests/error_016_dynamic_import_permissions2.js
+1
-1
cli/tests/integration_tests.rs
cli/tests/integration_tests.rs
+1
-1
cli/worker.rs
cli/worker.rs
+2
-2
core/js_errors.rs
core/js_errors.rs
+7
-7
tests
tests
+0
-1
tools/benchmark.py
tools/benchmark.py
+7
-7
tools/deno_dir_test.py
tools/deno_dir_test.py
+1
-1
tools/fetch_test.py
tools/fetch_test.py
+1
-1
tools/http_server.py
tools/http_server.py
+1
-1
tools/repl_test.py
tools/repl_test.py
+1
-1
tools/target_test.py
tools/target_test.py
+1
-1
tools/throughput_benchmark.py
tools/throughput_benchmark.py
+2
-2
tools/util.py
tools/util.py
+1
-1
未找到文件。
cli/compilers/ts.rs
浏览文件 @
f168597b
...
@@ -700,7 +700,7 @@ mod tests {
...
@@ -700,7 +700,7 @@ mod tests {
let
p
=
std
::
path
::
PathBuf
::
from
(
env!
(
"CARGO_MANIFEST_DIR"
))
let
p
=
std
::
path
::
PathBuf
::
from
(
env!
(
"CARGO_MANIFEST_DIR"
))
.parent
()
.parent
()
.unwrap
()
.unwrap
()
.join
(
"tests/002_hello.ts"
);
.join
(
"
cli/
tests/002_hello.ts"
);
let
specifier
=
let
specifier
=
ModuleSpecifier
::
resolve_url_or_path
(
p
.to_str
()
.unwrap
())
.unwrap
();
ModuleSpecifier
::
resolve_url_or_path
(
p
.to_str
()
.unwrap
())
.unwrap
();
...
@@ -739,7 +739,7 @@ mod tests {
...
@@ -739,7 +739,7 @@ mod tests {
let
p
=
std
::
path
::
PathBuf
::
from
(
env!
(
"CARGO_MANIFEST_DIR"
))
let
p
=
std
::
path
::
PathBuf
::
from
(
env!
(
"CARGO_MANIFEST_DIR"
))
.parent
()
.parent
()
.unwrap
()
.unwrap
()
.join
(
"tests/002_hello.ts"
);
.join
(
"
cli/
tests/002_hello.ts"
);
use
deno_core
::
ModuleSpecifier
;
use
deno_core
::
ModuleSpecifier
;
let
module_name
=
ModuleSpecifier
::
resolve_url_or_path
(
p
.to_str
()
.unwrap
())
let
module_name
=
ModuleSpecifier
::
resolve_url_or_path
(
p
.to_str
()
.unwrap
())
.unwrap
()
.unwrap
()
...
...
cli/file_fetcher.rs
浏览文件 @
f168597b
...
@@ -1005,7 +1005,7 @@ mod tests {
...
@@ -1005,7 +1005,7 @@ mod tests {
let
fetcher_1
=
fetcher
.clone
();
let
fetcher_1
=
fetcher
.clone
();
let
fetcher_2
=
fetcher
.clone
();
let
fetcher_2
=
fetcher
.clone
();
let
module_url
=
let
module_url
=
Url
::
parse
(
"http://localhost:4545/tests/subdir/mod2.ts"
)
.unwrap
();
Url
::
parse
(
"http://localhost:4545/
cli/
tests/subdir/mod2.ts"
)
.unwrap
();
let
module_url_1
=
module_url
.clone
();
let
module_url_1
=
module_url
.clone
();
let
module_url_2
=
module_url
.clone
();
let
module_url_2
=
module_url
.clone
();
let
headers_file_name
=
fetcher
.deps_cache.location
.join
(
let
headers_file_name
=
fetcher
.deps_cache.location
.join
(
...
@@ -1106,7 +1106,8 @@ mod tests {
...
@@ -1106,7 +1106,8 @@ mod tests {
let
(
temp_dir
,
fetcher
)
=
test_setup
();
let
(
temp_dir
,
fetcher
)
=
test_setup
();
let
fetcher_1
=
fetcher
.clone
();
let
fetcher_1
=
fetcher
.clone
();
let
module_url
=
let
module_url
=
Url
::
parse
(
"http://localhost:4545/tests/subdir/mismatch_ext.ts"
)
.unwrap
();
Url
::
parse
(
"http://localhost:4545/cli/tests/subdir/mismatch_ext.ts"
)
.unwrap
();
let
module_url_1
=
module_url
.clone
();
let
module_url_1
=
module_url
.clone
();
let
module_url_2
=
module_url
.clone
();
let
module_url_2
=
module_url
.clone
();
let
headers_file_name
=
fetcher
.deps_cache.location
.join
(
let
headers_file_name
=
fetcher
.deps_cache.location
.join
(
...
@@ -1183,7 +1184,7 @@ mod tests {
...
@@ -1183,7 +1184,7 @@ mod tests {
let
http_server_guard
=
crate
::
test_util
::
http_server
();
let
http_server_guard
=
crate
::
test_util
::
http_server
();
let
(
_
temp_dir
,
fetcher
)
=
test_setup
();
let
(
_
temp_dir
,
fetcher
)
=
test_setup
();
let
specifier
=
ModuleSpecifier
::
resolve_url
(
let
specifier
=
ModuleSpecifier
::
resolve_url
(
"http://localhost:4545/tests/subdir/mismatch_ext.ts"
,
"http://localhost:4545/
cli/
tests/subdir/mismatch_ext.ts"
,
)
)
.unwrap
();
.unwrap
();
let
headers_file_name
=
fetcher
.deps_cache.location
.join
(
let
headers_file_name
=
fetcher
.deps_cache.location
.join
(
...
@@ -1231,22 +1232,24 @@ mod tests {
...
@@ -1231,22 +1232,24 @@ mod tests {
let
http_server_guard
=
crate
::
test_util
::
http_server
();
let
http_server_guard
=
crate
::
test_util
::
http_server
();
let
(
_
temp_dir
,
fetcher
)
=
test_setup
();
let
(
_
temp_dir
,
fetcher
)
=
test_setup
();
let
redirect_module_url
=
let
redirect_module_url
=
Url
::
parse
(
Url
::
parse
(
"http://localhost:4546/tests/subdir/redirects/redirect1.js"
)
"http://localhost:4546/cli/tests/subdir/redirects/redirect1.js"
,
.unwrap
();
)
.unwrap
();
let
redirect_source_filepath
=
fetcher
let
redirect_source_filepath
=
fetcher
.deps_cache
.deps_cache
.location
.location
.join
(
"http/localhost_PORT4546/tests/subdir/redirects/redirect1.js"
);
.join
(
"http/localhost_PORT4546/
cli/
tests/subdir/redirects/redirect1.js"
);
let
redirect_source_filename
=
let
redirect_source_filename
=
redirect_source_filepath
.to_str
()
.unwrap
()
.to_string
();
redirect_source_filepath
.to_str
()
.unwrap
()
.to_string
();
let
target_module_url
=
let
target_module_url
=
Url
::
parse
(
Url
::
parse
(
"http://localhost:4545/tests/subdir/redirects/redirect1.js"
)
"http://localhost:4545/cli/tests/subdir/redirects/redirect1.js"
,
.unwrap
();
)
.unwrap
();
let
redirect_target_filepath
=
fetcher
let
redirect_target_filepath
=
fetcher
.deps_cache
.deps_cache
.location
.location
.join
(
"http/localhost_PORT4545/tests/subdir/redirects/redirect1.js"
);
.join
(
"http/localhost_PORT4545/
cli/
tests/subdir/redirects/redirect1.js"
);
let
redirect_target_filename
=
let
redirect_target_filename
=
redirect_target_filepath
.to_str
()
.unwrap
()
.to_string
();
redirect_target_filepath
.to_str
()
.unwrap
()
.to_string
();
...
@@ -1263,7 +1266,7 @@ mod tests {
...
@@ -1263,7 +1266,7 @@ mod tests {
fetcher
.get_source_code_headers
(
&
redirect_module_url
);
fetcher
.get_source_code_headers
(
&
redirect_module_url
);
assert_eq!
(
assert_eq!
(
redirect_source_headers
.redirect_to
.unwrap
(),
redirect_source_headers
.redirect_to
.unwrap
(),
"http://localhost:4545/tests/subdir/redirects/redirect1.js"
"http://localhost:4545/
cli/
tests/subdir/redirects/redirect1.js"
);
);
// The target of redirection is downloaded instead.
// The target of redirection is downloaded instead.
assert_eq!
(
assert_eq!
(
...
@@ -1286,29 +1289,32 @@ mod tests {
...
@@ -1286,29 +1289,32 @@ mod tests {
fn
test_get_source_code_4
()
{
fn
test_get_source_code_4
()
{
let
http_server_guard
=
crate
::
test_util
::
http_server
();
let
http_server_guard
=
crate
::
test_util
::
http_server
();
let
(
_
temp_dir
,
fetcher
)
=
test_setup
();
let
(
_
temp_dir
,
fetcher
)
=
test_setup
();
let
double_redirect_url
=
let
double_redirect_url
=
Url
::
parse
(
Url
::
parse
(
"http://localhost:4548/tests/subdir/redirects/redirect1.js"
)
"http://localhost:4548/cli/tests/subdir/redirects/redirect1.js"
,
.unwrap
();
)
.unwrap
();
let
double_redirect_path
=
fetcher
let
double_redirect_path
=
fetcher
.deps_cache
.deps_cache
.location
.location
.join
(
"http/localhost_PORT4548/tests/subdir/redirects/redirect1.js"
);
.join
(
"http/localhost_PORT4548/
cli/
tests/subdir/redirects/redirect1.js"
);
let
redirect_url
=
let
redirect_url
=
Url
::
parse
(
Url
::
parse
(
"http://localhost:4546/tests/subdir/redirects/redirect1.js"
)
"http://localhost:4546/cli/tests/subdir/redirects/redirect1.js"
,
.unwrap
();
)
.unwrap
();
let
redirect_path
=
fetcher
let
redirect_path
=
fetcher
.deps_cache
.deps_cache
.location
.location
.join
(
"http/localhost_PORT4546/tests/subdir/redirects/redirect1.js"
);
.join
(
"http/localhost_PORT4546/
cli/
tests/subdir/redirects/redirect1.js"
);
let
target_url
=
let
target_url
=
Url
::
parse
(
Url
::
parse
(
"http://localhost:4545/tests/subdir/redirects/redirect1.js"
)
"http://localhost:4545/cli/tests/subdir/redirects/redirect1.js"
,
.unwrap
();
)
.unwrap
();
let
target_path
=
fetcher
let
target_path
=
fetcher
.deps_cache
.deps_cache
.location
.location
.join
(
"http/localhost_PORT4545/tests/subdir/redirects/redirect1.js"
);
.join
(
"http/localhost_PORT4545/
cli/
tests/subdir/redirects/redirect1.js"
);
// Test double redirects and headers recording
// Test double redirects and headers recording
let
fut
=
fetcher
let
fut
=
fetcher
...
@@ -1353,18 +1359,20 @@ mod tests {
...
@@ -1353,18 +1359,20 @@ mod tests {
let
http_server_guard
=
crate
::
test_util
::
http_server
();
let
http_server_guard
=
crate
::
test_util
::
http_server
();
let
(
_
temp_dir
,
fetcher
)
=
test_setup
();
let
(
_
temp_dir
,
fetcher
)
=
test_setup
();
let
double_redirect_url
=
let
double_redirect_url
=
Url
::
parse
(
Url
::
parse
(
"http://localhost:4548/tests/subdir/redirects/redirect1.js"
)
"http://localhost:4548/cli/tests/subdir/redirects/redirect1.js"
,
.unwrap
();
)
.unwrap
();
let
redirect_url
=
let
redirect_url
=
Url
::
parse
(
Url
::
parse
(
"http://localhost:4546/tests/subdir/redirects/redirect1.js"
)
"http://localhost:4546/cli/tests/subdir/redirects/redirect1.js"
,
.unwrap
();
)
.unwrap
();
let
target_path
=
fetcher
let
target_path
=
fetcher
.deps_cache
.deps_cache
.location
.location
.join
(
"http/localhost_PORT4545/tests/subdir/redirects/redirect1.js"
);
.join
(
"http/localhost_PORT4545/
cli/
tests/subdir/redirects/redirect1.js"
);
let
target_path_
=
target_path
.clone
();
let
target_path_
=
target_path
.clone
();
// Test that redirect target is not downloaded twice for different redirect source.
// Test that redirect target is not downloaded twice for different redirect source.
...
@@ -1406,9 +1414,10 @@ mod tests {
...
@@ -1406,9 +1414,10 @@ mod tests {
fn
test_get_source_code_6
()
{
fn
test_get_source_code_6
()
{
let
http_server_guard
=
crate
::
test_util
::
http_server
();
let
http_server_guard
=
crate
::
test_util
::
http_server
();
let
(
_
temp_dir
,
fetcher
)
=
test_setup
();
let
(
_
temp_dir
,
fetcher
)
=
test_setup
();
let
double_redirect_url
=
let
double_redirect_url
=
Url
::
parse
(
Url
::
parse
(
"http://localhost:4548/tests/subdir/redirects/redirect1.js"
)
"http://localhost:4548/cli/tests/subdir/redirects/redirect1.js"
,
.unwrap
();
)
.unwrap
();
// Test that redirections can be limited
// Test that redirections can be limited
let
fut
=
fetcher
let
fut
=
fetcher
...
@@ -1432,7 +1441,7 @@ mod tests {
...
@@ -1432,7 +1441,7 @@ mod tests {
let
http_server_guard
=
crate
::
test_util
::
http_server
();
let
http_server_guard
=
crate
::
test_util
::
http_server
();
let
(
_
temp_dir
,
fetcher
)
=
test_setup
();
let
(
_
temp_dir
,
fetcher
)
=
test_setup
();
let
module_url
=
let
module_url
=
Url
::
parse
(
"http://localhost:4545/tests/002_hello.ts"
)
.unwrap
();
Url
::
parse
(
"http://localhost:4545/
cli/
tests/002_hello.ts"
)
.unwrap
();
// Remote modules are not allowed
// Remote modules are not allowed
let
fut
=
fetcher
let
fut
=
fetcher
.get_source_file_async
(
&
module_url
,
true
,
true
,
false
)
.get_source_file_async
(
&
module_url
,
true
,
true
,
false
)
...
@@ -1453,7 +1462,7 @@ mod tests {
...
@@ -1453,7 +1462,7 @@ mod tests {
let
fetcher_1
=
fetcher
.clone
();
let
fetcher_1
=
fetcher
.clone
();
let
fetcher_2
=
fetcher
.clone
();
let
fetcher_2
=
fetcher
.clone
();
let
module_url
=
let
module_url
=
Url
::
parse
(
"http://localhost:4545/tests/002_hello.ts"
)
.unwrap
();
Url
::
parse
(
"http://localhost:4545/
cli/
tests/002_hello.ts"
)
.unwrap
();
let
module_url_1
=
module_url
.clone
();
let
module_url_1
=
module_url
.clone
();
let
module_url_2
=
module_url
.clone
();
let
module_url_2
=
module_url
.clone
();
// file hasn't been cached before
// file hasn't been cached before
...
@@ -1485,7 +1494,7 @@ mod tests {
...
@@ -1485,7 +1494,7 @@ mod tests {
let
http_server_guard
=
crate
::
test_util
::
http_server
();
let
http_server_guard
=
crate
::
test_util
::
http_server
();
let
(
_
temp_dir
,
fetcher
)
=
test_setup
();
let
(
_
temp_dir
,
fetcher
)
=
test_setup
();
let
module_url
=
let
module_url
=
Url
::
parse
(
"http://127.0.0.1:4545/tests/subdir/mt_video_mp2t.t3.ts"
)
Url
::
parse
(
"http://127.0.0.1:4545/
cli/
tests/subdir/mt_video_mp2t.t3.ts"
)
.unwrap
();
.unwrap
();
let
headers_file_name
=
fetcher
.deps_cache.location
.join
(
let
headers_file_name
=
fetcher
.deps_cache.location
.join
(
fetcher
fetcher
...
@@ -1528,7 +1537,7 @@ mod tests {
...
@@ -1528,7 +1537,7 @@ mod tests {
let
(
_
temp_dir
,
fetcher
)
=
test_setup
();
let
(
_
temp_dir
,
fetcher
)
=
test_setup
();
let
module_url
=
let
module_url
=
Url
::
parse
(
"http://localhost:4545/tests/subdir/mt_video_mp2t.t3.ts"
)
Url
::
parse
(
"http://localhost:4545/
cli/
tests/subdir/mt_video_mp2t.t3.ts"
)
.unwrap
();
.unwrap
();
let
headers_file_name
=
fetcher
.deps_cache.location
.join
(
let
headers_file_name
=
fetcher
.deps_cache.location
.join
(
fetcher
fetcher
...
@@ -1574,12 +1583,13 @@ mod tests {
...
@@ -1574,12 +1583,13 @@ mod tests {
let
fetcher_2
=
fetcher
.clone
();
let
fetcher_2
=
fetcher
.clone
();
let
fetcher_3
=
fetcher
.clone
();
let
fetcher_3
=
fetcher
.clone
();
let
module_url
=
let
module_url
=
Url
::
parse
(
"http://localhost:4545/tests/subdir/no_ext"
)
.unwrap
();
Url
::
parse
(
"http://localhost:4545/
cli/
tests/subdir/no_ext"
)
.unwrap
();
let
module_url_2
=
let
module_url_2
=
Url
::
parse
(
"http://localhost:4545/tests/subdir/mismatch_ext.ts"
)
.unwrap
();
Url
::
parse
(
"http://localhost:4545/cli/tests/subdir/mismatch_ext.ts"
)
.unwrap
();
let
module_url_2_
=
module_url_2
.clone
();
let
module_url_2_
=
module_url_2
.clone
();
let
module_url_3
=
let
module_url_3
=
Url
::
parse
(
"http://localhost:4545/tests/subdir/unknown_ext.deno"
)
Url
::
parse
(
"http://localhost:4545/
cli/
tests/subdir/unknown_ext.deno"
)
.unwrap
();
.unwrap
();
let
module_url_3_
=
module_url_3
.clone
();
let
module_url_3_
=
module_url_3
.clone
();
...
...
cli/installer.rs
浏览文件 @
f168597b
...
@@ -257,7 +257,7 @@ mod tests {
...
@@ -257,7 +257,7 @@ mod tests {
DenoFlags
::
default
(),
DenoFlags
::
default
(),
None
,
None
,
"echo_test"
,
"echo_test"
,
"http://localhost:4545/tests/echo_server.ts"
,
"http://localhost:4545/
cli/
tests/echo_server.ts"
,
vec!
[],
vec!
[],
)
)
.expect
(
"Install failed"
);
.expect
(
"Install failed"
);
...
@@ -274,11 +274,11 @@ mod tests {
...
@@ -274,11 +274,11 @@ mod tests {
let
expected_content
=
if
cfg!
(
windows
)
{
let
expected_content
=
if
cfg!
(
windows
)
{
r#"% This executable is generated by Deno. Please don't modify it unless you know what it means. %
r#"% This executable is generated by Deno. Please don't modify it unless you know what it means. %
@IF EXIST "%~dp0\deno.exe" (
@IF EXIST "%~dp0\deno.exe" (
"%~dp0\deno.exe" "run" "http://localhost:4545/tests/echo_server.ts" %*
"%~dp0\deno.exe" "run" "http://localhost:4545/
cli/
tests/echo_server.ts" %*
) ELSE (
) ELSE (
@SETLOCAL
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.TS;=;%
@SET PATHEXT=%PATHEXT:;.TS;=;%
"deno" "run" "http://localhost:4545/tests/echo_server.ts" %*
"deno" "run" "http://localhost:4545/
cli/
tests/echo_server.ts" %*
)
)
"#
"#
}
else
{
}
else
{
...
@@ -291,10 +291,10 @@ case \`uname\` in
...
@@ -291,10 +291,10 @@ case \`uname\` in
esac
esac
if [ -x "$basedir/deno" ]; then
if [ -x "$basedir/deno" ]; then
"$basedir/deno" "run" "http://localhost:4545/tests/echo_server.ts" "$@"
"$basedir/deno" "run" "http://localhost:4545/
cli/
tests/echo_server.ts" "$@"
ret=$?
ret=$?
else
else
"deno" "run" "http://localhost:4545/tests/echo_server.ts" "$@"
"deno" "run" "http://localhost:4545/
cli/
tests/echo_server.ts" "$@"
ret=$?
ret=$?
fi
fi
exit $ret
exit $ret
...
@@ -319,7 +319,7 @@ exit $ret
...
@@ -319,7 +319,7 @@ exit $ret
DenoFlags
::
default
(),
DenoFlags
::
default
(),
Some
(
temp_dir
.path
()
.to_string_lossy
()
.to_string
()),
Some
(
temp_dir
.path
()
.to_string_lossy
()
.to_string
()),
"echo_test"
,
"echo_test"
,
"http://localhost:4545/tests/echo_server.ts"
,
"http://localhost:4545/
cli/
tests/echo_server.ts"
,
vec!
[],
vec!
[],
)
)
.expect
(
"Install failed"
);
.expect
(
"Install failed"
);
...
@@ -335,11 +335,11 @@ exit $ret
...
@@ -335,11 +335,11 @@ exit $ret
let
expected_content
=
if
cfg!
(
windows
)
{
let
expected_content
=
if
cfg!
(
windows
)
{
r#"% This executable is generated by Deno. Please don't modify it unless you know what it means. %
r#"% This executable is generated by Deno. Please don't modify it unless you know what it means. %
@IF EXIST "%~dp0\deno.exe" (
@IF EXIST "%~dp0\deno.exe" (
"%~dp0\deno.exe" "run" "http://localhost:4545/tests/echo_server.ts" %*
"%~dp0\deno.exe" "run" "http://localhost:4545/
cli/
tests/echo_server.ts" %*
) ELSE (
) ELSE (
@SETLOCAL
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.TS;=;%
@SET PATHEXT=%PATHEXT:;.TS;=;%
"deno" "run" "http://localhost:4545/tests/echo_server.ts" %*
"deno" "run" "http://localhost:4545/
cli/
tests/echo_server.ts" %*
)
)
"#
"#
}
else
{
}
else
{
...
@@ -352,10 +352,10 @@ case \`uname\` in
...
@@ -352,10 +352,10 @@ case \`uname\` in
esac
esac
if [ -x "$basedir/deno" ]; then
if [ -x "$basedir/deno" ]; then
"$basedir/deno" "run" "http://localhost:4545/tests/echo_server.ts" "$@"
"$basedir/deno" "run" "http://localhost:4545/
cli/
tests/echo_server.ts" "$@"
ret=$?
ret=$?
else
else
"deno" "run" "http://localhost:4545/tests/echo_server.ts" "$@"
"deno" "run" "http://localhost:4545/
cli/
tests/echo_server.ts" "$@"
ret=$?
ret=$?
fi
fi
exit $ret
exit $ret
...
@@ -377,7 +377,7 @@ exit $ret
...
@@ -377,7 +377,7 @@ exit $ret
},
},
Some
(
temp_dir
.path
()
.to_string_lossy
()
.to_string
()),
Some
(
temp_dir
.path
()
.to_string_lossy
()
.to_string
()),
"echo_test"
,
"echo_test"
,
"http://localhost:4545/tests/echo_server.ts"
,
"http://localhost:4545/
cli/
tests/echo_server.ts"
,
vec!
[
"--foobar"
.to_string
()],
vec!
[
"--foobar"
.to_string
()],
)
)
.expect
(
"Install failed"
);
.expect
(
"Install failed"
);
...
@@ -393,11 +393,11 @@ exit $ret
...
@@ -393,11 +393,11 @@ exit $ret
let
expected_content
=
if
cfg!
(
windows
)
{
let
expected_content
=
if
cfg!
(
windows
)
{
r#"% This executable is generated by Deno. Please don't modify it unless you know what it means. %
r#"% This executable is generated by Deno. Please don't modify it unless you know what it means. %
@IF EXIST "%~dp0\deno.exe" (
@IF EXIST "%~dp0\deno.exe" (
"%~dp0\deno.exe" "run" "--allow-read" "--allow-net" "http://localhost:4545/tests/echo_server.ts" "--foobar" %*
"%~dp0\deno.exe" "run" "--allow-read" "--allow-net" "http://localhost:4545/
cli/
tests/echo_server.ts" "--foobar" %*
) ELSE (
) ELSE (
@SETLOCAL
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.TS;=;%
@SET PATHEXT=%PATHEXT:;.TS;=;%
"deno" "run" "--allow-read" "--allow-net" "http://localhost:4545/tests/echo_server.ts" "--foobar" %*
"deno" "run" "--allow-read" "--allow-net" "http://localhost:4545/
cli/
tests/echo_server.ts" "--foobar" %*
)
)
"#
"#
}
else
{
}
else
{
...
@@ -410,10 +410,10 @@ case \`uname\` in
...
@@ -410,10 +410,10 @@ case \`uname\` in
esac
esac
if [ -x "$basedir/deno" ]; then
if [ -x "$basedir/deno" ]; then
"$basedir/deno" "run" "--allow-read" "--allow-net" "http://localhost:4545/tests/echo_server.ts" "--foobar" "$@"
"$basedir/deno" "run" "--allow-read" "--allow-net" "http://localhost:4545/
cli/
tests/echo_server.ts" "--foobar" "$@"
ret=$?
ret=$?
else
else
"deno" "run" "--allow-read" "--allow-net" "http://localhost:4545/tests/echo_server.ts" "--foobar" "$@"
"deno" "run" "--allow-read" "--allow-net" "http://localhost:4545/
cli/
tests/echo_server.ts" "--foobar" "$@"
ret=$?
ret=$?
fi
fi
exit $ret
exit $ret
...
...
cli/js/body_test.ts
浏览文件 @
f168597b
...
@@ -34,7 +34,7 @@ test(async function arrayBufferFromByteArrays(): Promise<void> {
...
@@ -34,7 +34,7 @@ test(async function arrayBufferFromByteArrays(): Promise<void> {
//FormData
//FormData
testPerm
({
net
:
true
},
async
function
bodyMultipartFormData
():
Promise
<
void
>
{
testPerm
({
net
:
true
},
async
function
bodyMultipartFormData
():
Promise
<
void
>
{
const
response
=
await
fetch
(
const
response
=
await
fetch
(
"
http://localhost:4545/tests/subdir/multipart_form_data.txt
"
"
http://localhost:4545/
cli/
tests/subdir/multipart_form_data.txt
"
);
);
const
text
=
await
response
.
text
();
const
text
=
await
response
.
text
();
...
@@ -51,7 +51,7 @@ testPerm({ net: true }, async function bodyMultipartFormData(): Promise<void> {
...
@@ -51,7 +51,7 @@ testPerm({ net: true }, async function bodyMultipartFormData(): Promise<void> {
testPerm
({
net
:
true
},
async
function
bodyURLEncodedFormData
():
Promise
<
void
>
{
testPerm
({
net
:
true
},
async
function
bodyURLEncodedFormData
():
Promise
<
void
>
{
const
response
=
await
fetch
(
const
response
=
await
fetch
(
"
http://localhost:4545/tests/subdir/form_urlencoded.txt
"
"
http://localhost:4545/
cli/
tests/subdir/form_urlencoded.txt
"
);
);
const
text
=
await
response
.
text
();
const
text
=
await
response
.
text
();
...
...
cli/js/compiler_util.ts
浏览文件 @
f168597b
...
@@ -293,7 +293,7 @@ export const ignoredDiagnostics = [
...
@@ -293,7 +293,7 @@ export const ignoredDiagnostics = [
// TS5009: Cannot find the common subdirectory path for the input files.
// TS5009: Cannot find the common subdirectory path for the input files.
5009
,
5009
,
// TS5055: Cannot write file
// TS5055: Cannot write file
// 'http://localhost:4545/tests/subdir/mt_application_x_javascript.j4.js'
// 'http://localhost:4545/
cli/
tests/subdir/mt_application_x_javascript.j4.js'
// because it would overwrite input file.
// because it would overwrite input file.
5055
,
5055
,
// TypeScript is overly opinionated that only CommonJS modules kinds can
// TypeScript is overly opinionated that only CommonJS modules kinds can
...
...
cli/js/fetch_test.ts
浏览文件 @
f168597b
...
@@ -114,7 +114,7 @@ testPerm({ net: true }, async function fetchMultipartFormDataSuccess(): Promise<
...
@@ -114,7 +114,7 @@ testPerm({ net: true }, async function fetchMultipartFormDataSuccess(): Promise<
void
void
>
{
>
{
const
response
=
await
fetch
(
const
response
=
await
fetch
(
"
http://localhost:4545/tests/subdir/multipart_form_data.txt
"
"
http://localhost:4545/
cli/
tests/subdir/multipart_form_data.txt
"
);
);
const
formData
=
await
response
.
formData
();
const
formData
=
await
response
.
formData
();
assert
(
formData
.
has
(
"
field_1
"
));
assert
(
formData
.
has
(
"
field_1
"
));
...
@@ -131,7 +131,7 @@ testPerm(
...
@@ -131,7 +131,7 @@ testPerm(
{
net
:
true
},
{
net
:
true
},
async
function
fetchURLEncodedFormDataSuccess
():
Promise
<
void
>
{
async
function
fetchURLEncodedFormDataSuccess
():
Promise
<
void
>
{
const
response
=
await
fetch
(
const
response
=
await
fetch
(
"
http://localhost:4545/tests/subdir/form_urlencoded.txt
"
"
http://localhost:4545/
cli/
tests/subdir/form_urlencoded.txt
"
);
);
const
formData
=
await
response
.
formData
();
const
formData
=
await
response
.
formData
();
assert
(
formData
.
has
(
"
field_1
"
));
assert
(
formData
.
has
(
"
field_1
"
));
...
@@ -153,11 +153,11 @@ testPerm({ net: true }, async function fetchWithRedirection(): Promise<void> {
...
@@ -153,11 +153,11 @@ testPerm({ net: true }, async function fetchWithRedirection(): Promise<void> {
testPerm
({
net
:
true
},
async
function
fetchWithRelativeRedirection
():
Promise
<
testPerm
({
net
:
true
},
async
function
fetchWithRelativeRedirection
():
Promise
<
void
void
>
{
>
{
const
response
=
await
fetch
(
"
http://localhost:4545/
tests
"
);
// will redirect to
/tests/
const
response
=
await
fetch
(
"
http://localhost:4545/
cli/tests
"
);
// will redirect to /cli
/tests/
assertEquals
(
response
.
status
,
200
);
assertEquals
(
response
.
status
,
200
);
assertEquals
(
response
.
statusText
,
"
OK
"
);
assertEquals
(
response
.
statusText
,
"
OK
"
);
const
body
=
await
response
.
text
();
const
body
=
await
response
.
text
();
assert
(
body
.
includes
(
"
<title>Directory listing for /tests/</title>
"
));
assert
(
body
.
includes
(
"
<title>Directory listing for /
cli/
tests/</title>
"
));
});
});
// The feature below is not implemented, but the test should work after implementation
// The feature below is not implemented, but the test should work after implementation
...
@@ -165,7 +165,7 @@ testPerm({ net: true }, async function fetchWithRelativeRedirection(): Promise<
...
@@ -165,7 +165,7 @@ testPerm({ net: true }, async function fetchWithRelativeRedirection(): Promise<
testPerm({ net: true }, async function fetchWithInfRedirection(): Promise<
testPerm({ net: true }, async function fetchWithInfRedirection(): Promise<
void
void
> {
> {
const response = await fetch("http://localhost:4549/tests"); // will redirect to the same place
const response = await fetch("http://localhost:4549/
cli/
tests"); // will redirect to the same place
assertEquals(response.status, 0); // network error
assertEquals(response.status, 0); // network error
});
});
*/
*/
...
...
cli/js/files_test.ts
浏览文件 @
f168597b
...
@@ -24,7 +24,7 @@ testPerm({ read: true }, async function filesCopyToStdout(): Promise<void> {
...
@@ -24,7 +24,7 @@ testPerm({ read: true }, async function filesCopyToStdout(): Promise<void> {
});
});
testPerm
({
read
:
true
},
async
function
filesToAsyncIterator
():
Promise
<
void
>
{
testPerm
({
read
:
true
},
async
function
filesToAsyncIterator
():
Promise
<
void
>
{
const
filename
=
"
tests/hello.txt
"
;
const
filename
=
"
cli/
tests/hello.txt
"
;
const
file
=
await
Deno
.
open
(
filename
);
const
file
=
await
Deno
.
open
(
filename
);
let
totalSize
=
0
;
let
totalSize
=
0
;
...
@@ -297,7 +297,7 @@ testPerm(
...
@@ -297,7 +297,7 @@ testPerm(
);
);
testPerm
({
read
:
true
},
async
function
seekStart
():
Promise
<
void
>
{
testPerm
({
read
:
true
},
async
function
seekStart
():
Promise
<
void
>
{
const
filename
=
"
tests/hello.txt
"
;
const
filename
=
"
cli/
tests/hello.txt
"
;
const
file
=
await
Deno
.
open
(
filename
);
const
file
=
await
Deno
.
open
(
filename
);
// Deliberately move 1 step forward
// Deliberately move 1 step forward
await
file
.
read
(
new
Uint8Array
(
1
));
// "H"
await
file
.
read
(
new
Uint8Array
(
1
));
// "H"
...
@@ -310,7 +310,7 @@ testPerm({ read: true }, async function seekStart(): Promise<void> {
...
@@ -310,7 +310,7 @@ testPerm({ read: true }, async function seekStart(): Promise<void> {
});
});
testPerm
({
read
:
true
},
function
seekSyncStart
():
void
{
testPerm
({
read
:
true
},
function
seekSyncStart
():
void
{
const
filename
=
"
tests/hello.txt
"
;
const
filename
=
"
cli/
tests/hello.txt
"
;
const
file
=
Deno
.
openSync
(
filename
);
const
file
=
Deno
.
openSync
(
filename
);
// Deliberately move 1 step forward
// Deliberately move 1 step forward
file
.
readSync
(
new
Uint8Array
(
1
));
// "H"
file
.
readSync
(
new
Uint8Array
(
1
));
// "H"
...
@@ -323,7 +323,7 @@ testPerm({ read: true }, function seekSyncStart(): void {
...
@@ -323,7 +323,7 @@ testPerm({ read: true }, function seekSyncStart(): void {
});
});
testPerm
({
read
:
true
},
async
function
seekCurrent
():
Promise
<
void
>
{
testPerm
({
read
:
true
},
async
function
seekCurrent
():
Promise
<
void
>
{
const
filename
=
"
tests/hello.txt
"
;
const
filename
=
"
cli/
tests/hello.txt
"
;
const
file
=
await
Deno
.
open
(
filename
);
const
file
=
await
Deno
.
open
(
filename
);
// Deliberately move 1 step forward
// Deliberately move 1 step forward
await
file
.
read
(
new
Uint8Array
(
1
));
// "H"
await
file
.
read
(
new
Uint8Array
(
1
));
// "H"
...
@@ -336,7 +336,7 @@ testPerm({ read: true }, async function seekCurrent(): Promise<void> {
...
@@ -336,7 +336,7 @@ testPerm({ read: true }, async function seekCurrent(): Promise<void> {
});
});
testPerm
({
read
:
true
},
function
seekSyncCurrent
():
void
{
testPerm
({
read
:
true
},
function
seekSyncCurrent
():
void
{
const
filename
=
"
tests/hello.txt
"
;
const
filename
=
"
cli/
tests/hello.txt
"
;
const
file
=
Deno
.
openSync
(
filename
);
const
file
=
Deno
.
openSync
(
filename
);
// Deliberately move 1 step forward
// Deliberately move 1 step forward
file
.
readSync
(
new
Uint8Array
(
1
));
// "H"
file
.
readSync
(
new
Uint8Array
(
1
));
// "H"
...
@@ -349,7 +349,7 @@ testPerm({ read: true }, function seekSyncCurrent(): void {
...
@@ -349,7 +349,7 @@ testPerm({ read: true }, function seekSyncCurrent(): void {
});
});
testPerm
({
read
:
true
},
async
function
seekEnd
():
Promise
<
void
>
{
testPerm
({
read
:
true
},
async
function
seekEnd
():
Promise
<
void
>
{
const
filename
=
"
tests/hello.txt
"
;
const
filename
=
"
cli/
tests/hello.txt
"
;
const
file
=
await
Deno
.
open
(
filename
);
const
file
=
await
Deno
.
open
(
filename
);
await
file
.
seek
(
-
6
,
Deno
.
SeekMode
.
SEEK_END
);
await
file
.
seek
(
-
6
,
Deno
.
SeekMode
.
SEEK_END
);
const
buf
=
new
Uint8Array
(
6
);
const
buf
=
new
Uint8Array
(
6
);
...
@@ -359,7 +359,7 @@ testPerm({ read: true }, async function seekEnd(): Promise<void> {
...
@@ -359,7 +359,7 @@ testPerm({ read: true }, async function seekEnd(): Promise<void> {
});
});
testPerm
({
read
:
true
},
function
seekSyncEnd
():
void
{
testPerm
({
read
:
true
},
function
seekSyncEnd
():
void
{
const
filename
=
"
tests/hello.txt
"
;
const
filename
=
"
cli/
tests/hello.txt
"
;
const
file
=
Deno
.
openSync
(
filename
);
const
file
=
Deno
.
openSync
(
filename
);
file
.
seekSync
(
-
6
,
Deno
.
SeekMode
.
SEEK_END
);
file
.
seekSync
(
-
6
,
Deno
.
SeekMode
.
SEEK_END
);
const
buf
=
new
Uint8Array
(
6
);
const
buf
=
new
Uint8Array
(
6
);
...
@@ -369,7 +369,7 @@ testPerm({ read: true }, function seekSyncEnd(): void {
...
@@ -369,7 +369,7 @@ testPerm({ read: true }, function seekSyncEnd(): void {
});
});
testPerm
({
read
:
true
},
async
function
seekMode
():
Promise
<
void
>
{
testPerm
({
read
:
true
},
async
function
seekMode
():
Promise
<
void
>
{
const
filename
=
"
tests/hello.txt
"
;
const
filename
=
"
cli/
tests/hello.txt
"
;
const
file
=
await
Deno
.
open
(
filename
);
const
file
=
await
Deno
.
open
(
filename
);
let
err
;
let
err
;
try
{
try
{
...
...
cli/js/read_dir_test.ts
浏览文件 @
f168597b
...
@@ -13,7 +13,7 @@ function assertSameContent(files: FileInfo[]): void {
...
@@ -13,7 +13,7 @@ function assertSameContent(files: FileInfo[]): void {
}
}
if
(
file
.
name
===
"
002_hello.ts
"
)
{
if
(
file
.
name
===
"
002_hello.ts
"
)
{
assertEquals
(
file
.
mode
!
,
Deno
.
statSync
(
`tests/
${
file
.
name
}
`
).
mode
!
);
assertEquals
(
file
.
mode
!
,
Deno
.
statSync
(
`
cli/
tests/
${
file
.
name
}
`
).
mode
!
);
counter
++
;
counter
++
;
}
}
}
}
...
@@ -22,7 +22,7 @@ function assertSameContent(files: FileInfo[]): void {
...
@@ -22,7 +22,7 @@ function assertSameContent(files: FileInfo[]): void {
}
}
testPerm
({
read
:
true
},
function
readDirSyncSuccess
():
void
{
testPerm
({
read
:
true
},
function
readDirSyncSuccess
():
void
{
const
files
=
Deno
.
readDirSync
(
"
tests/
"
);
const
files
=
Deno
.
readDirSync
(
"
cli/
tests/
"
);
assertSameContent
(
files
);
assertSameContent
(
files
);
});
});
...
@@ -67,7 +67,7 @@ testPerm({ read: true }, function readDirSyncNotFound(): void {
...
@@ -67,7 +67,7 @@ testPerm({ read: true }, function readDirSyncNotFound(): void {
});
});
testPerm
({
read
:
true
},
async
function
readDirSuccess
():
Promise
<
void
>
{
testPerm
({
read
:
true
},
async
function
readDirSuccess
():
Promise
<
void
>
{
const
files
=
await
Deno
.
readDir
(
"
tests/
"
);
const
files
=
await
Deno
.
readDir
(
"
cli/
tests/
"
);
assertSameContent
(
files
);
assertSameContent
(
files
);
});
});
...
...
cli/js/resources_test.ts
浏览文件 @
f168597b
...
@@ -31,7 +31,7 @@ testPerm({ net: true }, async function resourcesNet(): Promise<void> {
...
@@ -31,7 +31,7 @@ testPerm({ net: true }, async function resourcesNet(): Promise<void> {
testPerm
({
read
:
true
},
async
function
resourcesFile
():
Promise
<
void
>
{
testPerm
({
read
:
true
},
async
function
resourcesFile
():
Promise
<
void
>
{
const
resourcesBefore
=
Deno
.
resources
();
const
resourcesBefore
=
Deno
.
resources
();
await
Deno
.
open
(
"
tests/hello.txt
"
);
await
Deno
.
open
(
"
cli/
tests/hello.txt
"
);
const
resourcesAfter
=
Deno
.
resources
();
const
resourcesAfter
=
Deno
.
resources
();
// check that exactly one new resource (file) was added
// check that exactly one new resource (file) was added
...
...
cli/js/stat_test.ts
浏览文件 @
f168597b
...
@@ -12,7 +12,7 @@ testPerm({ read: true }, async function statSyncSuccess(): Promise<void> {
...
@@ -12,7 +12,7 @@ testPerm({ read: true }, async function statSyncSuccess(): Promise<void> {
assert
(
modulesInfo
.
isDirectory
());
assert
(
modulesInfo
.
isDirectory
());
assert
(
!
modulesInfo
.
isSymlink
());
assert
(
!
modulesInfo
.
isSymlink
());
const
testsInfo
=
Deno
.
statSync
(
"
tests
"
);
const
testsInfo
=
Deno
.
statSync
(
"
cli/
tests
"
);
assert
(
testsInfo
.
isDirectory
());
assert
(
testsInfo
.
isDirectory
());
assert
(
!
testsInfo
.
isSymlink
());
assert
(
!
testsInfo
.
isSymlink
());
});
});
...
@@ -96,7 +96,7 @@ testPerm({ read: true }, async function statSuccess(): Promise<void> {
...
@@ -96,7 +96,7 @@ testPerm({ read: true }, async function statSuccess(): Promise<void> {
assert
(
modulesInfo
.
isDirectory
());
assert
(
modulesInfo
.
isDirectory
());
assert
(
!
modulesInfo
.
isSymlink
());
assert
(
!
modulesInfo
.
isSymlink
());
const
i
=
await
Deno
.
stat
(
"
tests
"
);
const
i
=
await
Deno
.
stat
(
"
cli/
tests
"
);
assert
(
i
.
isDirectory
());
assert
(
i
.
isDirectory
());
assert
(
!
i
.
isSymlink
());
assert
(
!
i
.
isSymlink
());
});
});
...
...
cli/source_maps.rs
浏览文件 @
f168597b
...
@@ -436,12 +436,12 @@ mod tests {
...
@@ -436,12 +436,12 @@ mod tests {
#[test]
#[test]
fn
source_map_from_json
()
{
fn
source_map_from_json
()
{
let
json
=
r#"{"version":3,"file":"error_001.js","sourceRoot":"","sources":["file:///Users/rld/src/deno/tests/error_001.ts"],"names":[],"mappings":"AAAA,SAAS,GAAG;IACV,MAAM,KAAK,CAAC,KAAK,CAAC,CAAC;AACrB,CAAC;AAED,SAAS,GAAG;IACV,GAAG,EAAE,CAAC;AACR,CAAC;AAED,GAAG,EAAE,CAAC"}"#
;
let
json
=
r#"{"version":3,"file":"error_001.js","sourceRoot":"","sources":["file:///Users/rld/src/deno/
cli/
tests/error_001.ts"],"names":[],"mappings":"AAAA,SAAS,GAAG;IACV,MAAM,KAAK,CAAC,KAAK,CAAC,CAAC;AACrB,CAAC;AAED,SAAS,GAAG;IACV,GAAG,EAAE,CAAC;AACR,CAAC;AAED,GAAG,EAAE,CAAC"}"#
;
let
sm
=
SourceMap
::
from_json
(
json
)
.unwrap
();
let
sm
=
SourceMap
::
from_json
(
json
)
.unwrap
();
assert_eq!
(
sm
.sources
.len
(),
1
);
assert_eq!
(
sm
.sources
.len
(),
1
);
assert_eq!
(
assert_eq!
(
sm
.sources
[
0
],
sm
.sources
[
0
],
"file:///Users/rld/src/deno/tests/error_001.ts"
"file:///Users/rld/src/deno/
cli/
tests/error_001.ts"
);
);
let
mapping
=
sm
let
mapping
=
sm
.mappings
.mappings
...
...
cli/tests/README.md
浏览文件 @
f168597b
# Integration Tests
# Integration Tests
This path contains integration tests. See integration_tests.rs for the index.
This path contains integration tests. See integration_tests.rs for the index.
TODO(ry) Currently //tests is a symlink to //cli/tests, to simplify transition.
In the future the symlink should be removed when all the many references have
been updated to the new path.
cli/tests/error_003_typescript.ts.out
浏览文件 @
f168597b
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
The types of 'a.b.c().d' are incompatible between these types.
The types of 'a.b.c().d' are incompatible between these types.
Type 'number' is not assignable to type 'string'.
Type 'number' is not assignable to type 'string'.
[WILDCARD]/tests/error_003_typescript.ts:20:1
[WILDCARD]/
cli/
tests/error_003_typescript.ts:20:1
20 x = y;
20 x = y;
^
^
...
...
cli/tests/error_015_dynamic_import_permissions.js
浏览文件 @
f168597b
(
async
()
=>
{
(
async
()
=>
{
await
import
(
"
http://localhost:4545/tests/subdir/mod4.js
"
);
await
import
(
"
http://localhost:4545/
cli/
tests/subdir/mod4.js
"
);
})();
})();
cli/tests/error_015_dynamic_import_permissions.out
浏览文件 @
f168597b
error: Uncaught TypeError: network access to "http://localhost:4545/tests/subdir/mod4.js", run again with the --allow-net flag
error: Uncaught TypeError: network access to "http://localhost:4545/
cli/
tests/subdir/mod4.js", run again with the --allow-net flag
cli/tests/error_016_dynamic_import_permissions2.js
浏览文件 @
f168597b
// If this is executed with --allow-net but not --allow-read the following
// If this is executed with --allow-net but not --allow-read the following
// import should cause a permission denied error.
// import should cause a permission denied error.
(
async
()
=>
{
(
async
()
=>
{
await
import
(
"
http://localhost:4545/tests/subdir/evil_remote_import.js
"
);
await
import
(
"
http://localhost:4545/
cli/
tests/subdir/evil_remote_import.js
"
);
})();
})();
cli/tests/integration_tests.rs
浏览文件 @
f168597b
...
@@ -131,7 +131,7 @@ fn installer_test_remote_module_run() {
...
@@ -131,7 +131,7 @@ fn installer_test_remote_module_run() {
DenoFlags
::
default
(),
DenoFlags
::
default
(),
Some
(
temp_dir
.path
()
.to_string_lossy
()
.to_string
()),
Some
(
temp_dir
.path
()
.to_string_lossy
()
.to_string
()),
"echo_test"
,
"echo_test"
,
"http://localhost:4545/tests/echo.ts"
,
"http://localhost:4545/
cli/
tests/echo.ts"
,
vec!
[
"hello"
.to_string
()],
vec!
[
"hello"
.to_string
()],
)
)
.expect
(
"Failed to install"
);
.expect
(
"Failed to install"
);
...
...
cli/worker.rs
浏览文件 @
f168597b
...
@@ -264,7 +264,7 @@ mod tests {
...
@@ -264,7 +264,7 @@ mod tests {
let
p
=
std
::
path
::
PathBuf
::
from
(
env!
(
"CARGO_MANIFEST_DIR"
))
let
p
=
std
::
path
::
PathBuf
::
from
(
env!
(
"CARGO_MANIFEST_DIR"
))
.parent
()
.parent
()
.unwrap
()
.unwrap
()
.join
(
"tests/esm_imports_a.js"
);
.join
(
"
cli/
tests/esm_imports_a.js"
);
let
module_specifier
=
let
module_specifier
=
ModuleSpecifier
::
resolve_url_or_path
(
&
p
.to_string_lossy
())
.unwrap
();
ModuleSpecifier
::
resolve_url_or_path
(
&
p
.to_string_lossy
())
.unwrap
();
let
global_state
=
ThreadSafeGlobalState
::
new
(
let
global_state
=
ThreadSafeGlobalState
::
new
(
...
@@ -436,7 +436,7 @@ mod tests {
...
@@ -436,7 +436,7 @@ mod tests {
let
p
=
std
::
path
::
PathBuf
::
from
(
env!
(
"CARGO_MANIFEST_DIR"
))
let
p
=
std
::
path
::
PathBuf
::
from
(
env!
(
"CARGO_MANIFEST_DIR"
))
.parent
()
.parent
()
.unwrap
()
.unwrap
()
.join
(
"tests/002_hello.ts"
);
.join
(
"
cli/
tests/002_hello.ts"
);
let
module_specifier
=
let
module_specifier
=
ModuleSpecifier
::
resolve_url_or_path
(
&
p
.to_string_lossy
())
.unwrap
();
ModuleSpecifier
::
resolve_url_or_path
(
&
p
.to_string_lossy
())
.unwrap
();
let
result
=
let
result
=
...
...
core/js_errors.rs
浏览文件 @
f168597b
...
@@ -306,7 +306,7 @@ mod tests {
...
@@ -306,7 +306,7 @@ mod tests {
"line":2,
"line":2,
"column":11,
"column":11,
"functionName":"foo",
"functionName":"foo",
"scriptName":"/Users/rld/src/deno/tests/error_001.ts",
"scriptName":"/Users/rld/src/deno/
cli/
tests/error_001.ts",
"isEval":true,
"isEval":true,
"isConstructor":false,
"isConstructor":false,
"isWasm":false
"isWasm":false
...
@@ -319,7 +319,7 @@ mod tests {
...
@@ -319,7 +319,7 @@ mod tests {
Some
(
StackFrame
{
Some
(
StackFrame
{
line
:
1
,
line
:
1
,
column
:
10
,
column
:
10
,
script_name
:
"/Users/rld/src/deno/tests/error_001.ts"
.to_string
(),
script_name
:
"/Users/rld/src/deno/
cli/
tests/error_001.ts"
.to_string
(),
function_name
:
"foo"
.to_string
(),
function_name
:
"foo"
.to_string
(),
is_eval
:
true
,
is_eval
:
true
,
is_constructor
:
false
,
is_constructor
:
false
,
...
@@ -332,7 +332,7 @@ mod tests {
...
@@ -332,7 +332,7 @@ mod tests {
fn
stack_frame_from_json_value_2
()
{
fn
stack_frame_from_json_value_2
()
{
let
v
=
serde_json
::
from_str
::
<
serde_json
::
Value
>
(
let
v
=
serde_json
::
from_str
::
<
serde_json
::
Value
>
(
r#"{
r#"{
"scriptName": "/Users/rld/src/deno/tests/error_001.ts",
"scriptName": "/Users/rld/src/deno/
cli/
tests/error_001.ts",
"line": 2,
"line": 2,
"column": 11
"column": 11
}"#
,
}"#
,
...
@@ -343,7 +343,7 @@ mod tests {
...
@@ -343,7 +343,7 @@ mod tests {
let
f
=
r
.unwrap
();
let
f
=
r
.unwrap
();
assert_eq!
(
f
.line
,
1
);
assert_eq!
(
f
.line
,
1
);
assert_eq!
(
f
.column
,
10
);
assert_eq!
(
f
.column
,
10
);
assert_eq!
(
f
.script_name
,
"/Users/rld/src/deno/tests/error_001.ts"
);
assert_eq!
(
f
.script_name
,
"/Users/rld/src/deno/
cli/
tests/error_001.ts"
);
}
}
#[test]
#[test]
...
@@ -356,7 +356,7 @@ mod tests {
...
@@ -356,7 +356,7 @@ mod tests {
"line":2,
"line":2,
"column":11,
"column":11,
"functionName":"foo",
"functionName":"foo",
"scriptName":"/Users/rld/src/deno/tests/error_001.ts",
"scriptName":"/Users/rld/src/deno/
cli/
tests/error_001.ts",
"isEval":true,
"isEval":true,
"isConstructor":false,
"isConstructor":false,
"isWasm":false
"isWasm":false
...
@@ -364,7 +364,7 @@ mod tests {
...
@@ -364,7 +364,7 @@ mod tests {
"line":5,
"line":5,
"column":5,
"column":5,
"functionName":"bar",
"functionName":"bar",
"scriptName":"/Users/rld/src/deno/tests/error_001.ts",
"scriptName":"/Users/rld/src/deno/
cli/
tests/error_001.ts",
"isEval":true,
"isEval":true,
"isConstructor":false,
"isConstructor":false,
"isWasm":false
"isWasm":false
...
@@ -380,7 +380,7 @@ mod tests {
...
@@ -380,7 +380,7 @@ mod tests {
StackFrame
{
StackFrame
{
line
:
1
,
line
:
1
,
column
:
10
,
column
:
10
,
script_name
:
"/Users/rld/src/deno/tests/error_001.ts"
.to_string
(),
script_name
:
"/Users/rld/src/deno/
cli/
tests/error_001.ts"
.to_string
(),
function_name
:
"foo"
.to_string
(),
function_name
:
"foo"
.to_string
(),
is_eval
:
true
,
is_eval
:
true
,
is_constructor
:
false
,
is_constructor
:
false
,
...
...
tests
已删除
120000 → 0
浏览文件 @
e8df66c1
cli/tests
\ No newline at end of file
tools/benchmark.py
浏览文件 @
f168597b
...
@@ -20,13 +20,13 @@ import http_server
...
@@ -20,13 +20,13 @@ import http_server
# The list of the tuples of the benchmark name and arguments
# The list of the tuples of the benchmark name and arguments
exec_time_benchmarks
=
[
exec_time_benchmarks
=
[
(
"hello"
,
[
"tests/002_hello.ts"
]),
(
"hello"
,
[
"
cli/
tests/002_hello.ts"
]),
(
"relative_import"
,
[
"tests/003_relative_import.ts"
]),
(
"relative_import"
,
[
"
cli/
tests/003_relative_import.ts"
]),
(
"error_001"
,
[
"tests/error_001.ts"
]),
(
"error_001"
,
[
"
cli/
tests/error_001.ts"
]),
(
"cold_hello"
,
[
"--reload"
,
"tests/002_hello.ts"
]),
(
"cold_hello"
,
[
"--reload"
,
"
cli/
tests/002_hello.ts"
]),
(
"cold_relative_import"
,
[
"--reload"
,
"tests/003_relative_import.ts"
]),
(
"cold_relative_import"
,
[
"--reload"
,
"
cli/
tests/003_relative_import.ts"
]),
(
"workers_startup"
,
[
"tests/workers_startup_bench.ts"
]),
(
"workers_startup"
,
[
"
cli/
tests/workers_startup_bench.ts"
]),
(
"workers_round_robin"
,
[
"tests/workers_round_robin_bench.ts"
]),
(
"workers_round_robin"
,
[
"
cli/
tests/workers_round_robin_bench.ts"
]),
(
"text_decoder"
,
[
"cli/tests/text_decoder_perf.js"
]),
(
"text_decoder"
,
[
"cli/tests/text_decoder_perf.js"
]),
(
"text_encoder"
,
[
"cli/tests/text_encoder_perf.js"
]),
(
"text_encoder"
,
[
"cli/tests/text_encoder_perf.js"
]),
]
]
...
...
tools/deno_dir_test.py
浏览文件 @
f168597b
...
@@ -40,7 +40,7 @@ class TestDenoDir(DenoTestCase):
...
@@ -40,7 +40,7 @@ class TestDenoDir(DenoTestCase):
def
run_deno
(
self
,
deno_dir
=
None
):
def
run_deno
(
self
,
deno_dir
=
None
):
cmd
=
[
cmd
=
[
self
.
deno_exe
,
"run"
,
self
.
deno_exe
,
"run"
,
"http://localhost:4545/tests/subdir/print_hello.ts"
"http://localhost:4545/
cli/
tests/subdir/print_hello.ts"
]
]
deno_dir_env
=
{
"DENO_DIR"
:
deno_dir
}
if
deno_dir
is
not
None
else
None
deno_dir_env
=
{
"DENO_DIR"
:
deno_dir
}
if
deno_dir
is
not
None
else
None
res
=
run_output
(
cmd
,
quiet
=
True
,
env
=
deno_dir_env
)
res
=
run_output
(
cmd
,
quiet
=
True
,
env
=
deno_dir_env
)
...
...
tools/fetch_test.py
浏览文件 @
f168597b
...
@@ -23,7 +23,7 @@ class TestFetch(DenoTestCase):
...
@@ -23,7 +23,7 @@ class TestFetch(DenoTestCase):
os
.
path
.
exists
(
os
.
path
.
exists
(
os
.
path
.
join
(
os
.
path
.
join
(
deno_dir
,
deno_dir
,
"deps/http/localhost_PORT4545/tests/subdir/mod2.ts"
))
"deps/http/localhost_PORT4545/
cli/
tests/subdir/mod2.ts"
))
finally
:
finally
:
shutil
.
rmtree
(
deno_dir
)
shutil
.
rmtree
(
deno_dir
)
...
...
tools/http_server.py
浏览文件 @
f168597b
...
@@ -223,7 +223,7 @@ def redirect_server():
...
@@ -223,7 +223,7 @@ def redirect_server():
# BUT with an extra subdir path
# BUT with an extra subdir path
def
another_redirect_server
():
def
another_redirect_server
():
return
base_redirect_server
(
return
base_redirect_server
(
ANOTHER_REDIRECT_PORT
,
PORT
,
extra_path_segment
=
"/tests/subdir"
)
ANOTHER_REDIRECT_PORT
,
PORT
,
extra_path_segment
=
"/
cli/
tests/subdir"
)
# redirect server that points to another redirect server
# redirect server that points to another redirect server
...
...
tools/repl_test.py
浏览文件 @
f168597b
...
@@ -114,7 +114,7 @@ class TestRepl(DenoTestCase):
...
@@ -114,7 +114,7 @@ class TestRepl(DenoTestCase):
# def test_async_op(self):
# def test_async_op(self):
# out, err, code = self.input(
# out, err, code = self.input(
# "fetch('http://localhost:4545/tests/001_hello.js')" +
# "fetch('http://localhost:4545/
cli/
tests/001_hello.js')" +
# ".then(res => res.text()).then(console.log)",
# ".then(res => res.text()).then(console.log)",
# sleep=1)
# sleep=1)
# self.assertEqual(out, 'Promise {}\nconsole.log("Hello World");\n\n')
# self.assertEqual(out, 'Promise {}\nconsole.log("Hello World");\n\n')
...
...
tools/target_test.py
浏览文件 @
f168597b
...
@@ -34,7 +34,7 @@ class TestTarget(DenoTestCase):
...
@@ -34,7 +34,7 @@ class TestTarget(DenoTestCase):
def
test_exec_path
(
self
):
def
test_exec_path
(
self
):
cmd
=
[
cmd
=
[
self
.
deno_exe
,
"run"
,
"--allow-run"
,
"--allow-env"
,
self
.
deno_exe
,
"run"
,
"--allow-run"
,
"--allow-env"
,
"tests/exec_path.ts"
"
cli/
tests/exec_path.ts"
]
]
result
=
run_output
(
cmd
,
quiet
=
True
)
result
=
run_output
(
cmd
,
quiet
=
True
)
print
"exec_path"
,
result
print
"exec_path"
,
result
...
...
tools/throughput_benchmark.py
浏览文件 @
f168597b
...
@@ -21,7 +21,7 @@ def cat(deno_exe, megs):
...
@@ -21,7 +21,7 @@ def cat(deno_exe, megs):
size
=
megs
*
MB
size
=
megs
*
MB
start
=
time
.
time
()
start
=
time
.
time
()
cmd
=
deno_exe
+
" run --allow-read "
cmd
=
deno_exe
+
" run --allow-read "
cmd
+=
"tests/cat.ts /dev/zero | head -c %s "
%
size
cmd
+=
"
cli/
tests/cat.ts /dev/zero | head -c %s "
%
size
print
cmd
print
cmd
subprocess
.
check_output
(
cmd
,
shell
=
True
)
subprocess
.
check_output
(
cmd
,
shell
=
True
)
end
=
time
.
time
()
end
=
time
.
time
()
...
@@ -32,7 +32,7 @@ def tcp(deno_exe, megs):
...
@@ -32,7 +32,7 @@ def tcp(deno_exe, megs):
size
=
megs
*
MB
size
=
megs
*
MB
# Run deno echo server in the background.
# Run deno echo server in the background.
args
=
[
args
=
[
deno_exe
,
"run"
,
"--allow-net"
,
"tests/echo_server.ts"
,
SERVER_ADDR
deno_exe
,
"run"
,
"--allow-net"
,
"
cli/
tests/echo_server.ts"
,
SERVER_ADDR
]
]
print
args
print
args
echo_server
=
subprocess
.
Popen
(
args
)
echo_server
=
subprocess
.
Popen
(
args
)
...
...
tools/util.py
浏览文件 @
f168597b
...
@@ -21,7 +21,7 @@ executable_suffix = ".exe" if os.name == "nt" else ""
...
@@ -21,7 +21,7 @@ executable_suffix = ".exe" if os.name == "nt" else ""
root_path
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)))
root_path
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)))
libdeno_path
=
os
.
path
.
join
(
root_path
,
"core"
,
"libdeno"
)
libdeno_path
=
os
.
path
.
join
(
root_path
,
"core"
,
"libdeno"
)
tests_path
=
os
.
path
.
join
(
root_path
,
"tests"
)
tests_path
=
os
.
path
.
join
(
root_path
,
"
cli/
tests"
)
third_party_path
=
os
.
path
.
join
(
root_path
,
"third_party"
)
third_party_path
=
os
.
path
.
join
(
root_path
,
"third_party"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录