Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
deno
提交
9a960b9f
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,发现更多精彩内容 >>
未验证
提交
9a960b9f
编写于
12月 10, 2018
作者:
R
Ryan Dahl
提交者:
GitHub
12月 10, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use stderr for exceptions (#1303)
上级
1548792f
变更
23
隐藏空白更改
内联
并排
Showing
23 changed file
with
37 addition
and
36 deletion
+37
-36
src/deno_dir.rs
src/deno_dir.rs
+1
-1
src/main.rs
src/main.rs
+1
-3
tests/006_url_imports.ts.out
tests/006_url_imports.ts.out
+0
-2
tests/015_import_no_ext.ts.out
tests/015_import_no_ext.ts.out
+0
-3
tests/017_import_redirect.ts.out
tests/017_import_redirect.ts.out
+0
-1
tests/019_media_types.ts.out
tests/019_media_types.ts.out
+0
-8
tests/async_error.test
tests/async_error.test
+1
-0
tests/async_error.ts.out
tests/async_error.ts.out
+1
-1
tests/error_001.test
tests/error_001.test
+1
-0
tests/error_001.ts.out
tests/error_001.ts.out
+1
-1
tests/error_002.test
tests/error_002.test
+1
-0
tests/error_002.ts.out
tests/error_002.ts.out
+1
-1
tests/error_004_missing_module.test
tests/error_004_missing_module.test
+1
-0
tests/error_004_missing_module.ts.out
tests/error_004_missing_module.ts.out
+1
-1
tests/error_005_missing_dynamic_import.test
tests/error_005_missing_dynamic_import.test
+1
-0
tests/error_005_missing_dynamic_import.ts.out
tests/error_005_missing_dynamic_import.ts.out
+1
-1
tests/error_006_import_ext_failure.test
tests/error_006_import_ext_failure.test
+1
-0
tests/error_006_import_ext_failure.ts.out
tests/error_006_import_ext_failure.ts.out
+1
-1
tests/error_007_any.test
tests/error_007_any.test
+1
-0
tests/error_007_any.ts.out
tests/error_007_any.ts.out
+1
-1
tests/https_import.ts.out
tests/https_import.ts.out
+0
-1
tools/integration_tests.py
tools/integration_tests.py
+15
-1
tools/permission_prompt_test.py
tools/permission_prompt_test.py
+6
-9
未找到文件。
src/deno_dir.rs
浏览文件 @
9a960b9f
...
...
@@ -141,7 +141,7 @@ impl DenoDir {
let
mt
=
Path
::
new
(
&
media_type_filename
);
let
src
=
if
self
.reload
||
!
p
.exists
()
{
println!
(
"Downloading {}"
,
module_name
);
e
println!
(
"Downloading {}"
,
module_name
);
let
(
source
,
content_type
)
=
http_util
::
fetch_sync_string
(
module_name
)
?
;
match
p
.parent
()
{
Some
(
ref
parent
)
=>
fs
::
create_dir_all
(
parent
),
...
...
src/main.rs
浏览文件 @
9a960b9f
...
...
@@ -72,9 +72,7 @@ impl log::Log for Logger {
}
fn
print_err_and_exit
(
err
:
js_errors
::
JSError
)
{
// TODO Currently tests depend on exception going to stdout. It should go
// to stderr. https://github.com/denoland/deno/issues/964
println!
(
"{}"
,
err
.to_string
());
eprintln!
(
"{}"
,
err
.to_string
());
std
::
process
::
exit
(
1
);
}
...
...
tests/006_url_imports.ts.out
浏览文件 @
9a960b9f
Downloading http://localhost:4545/tests/subdir/mod2.ts
Downloading http://localhost:4545/tests/subdir/print_hello.ts
Hello
success
tests/015_import_no_ext.ts.out
浏览文件 @
9a960b9f
Downloading http://localhost:4545/tests/subdir/mod2
Downloading http://localhost:4545/tests/subdir/mod2.ts
Downloading http://localhost:4545/tests/subdir/print_hello.ts
true
[Function: printHello]
[Function: printHello]
...
...
tests/017_import_redirect.ts.out
浏览文件 @
9a960b9f
Downloading http://gist.githubusercontent.com/ry/f12b2aa3409e6b52645bc346a9e22929/raw/79318f239f51d764384a8bded8d7c6a833610dde/print_hello.ts
Hello
tests/019_media_types.ts.out
浏览文件 @
9a960b9f
Downloading http://localhost:4545/tests/subdir/mt_text_typescript.t1.ts
Downloading http://localhost:4545/tests/subdir/mt_video_vdn.t2.ts
Downloading http://localhost:4545/tests/subdir/mt_video_mp2t.t3.ts
Downloading http://localhost:4545/tests/subdir/mt_application_x_typescript.t4.ts
Downloading http://localhost:4545/tests/subdir/mt_text_javascript.j1.js
Downloading http://localhost:4545/tests/subdir/mt_application_ecmascript.j2.js
Downloading http://localhost:4545/tests/subdir/mt_text_ecmascript.j3.js
Downloading http://localhost:4545/tests/subdir/mt_application_x_javascript.j4.js
success true true true true true true true true
tests/async_error.test
浏览文件 @
9a960b9f
exit_code
:
1
args
:
tests
/
async_error
.
ts
--
reload
check_stderr
:
true
output
:
tests
/
async_error
.
ts
.
out
tests/async_error.ts.out
浏览文件 @
9a960b9f
hello
[WILDCARD]
hello
before error
world
Error: error
...
...
tests/error_001.test
浏览文件 @
9a960b9f
args
:
tests
/
error_001
.
ts
--
reload
check_stderr
:
true
exit_code
:
1
output
:
tests
/
error_001
.
ts
.
out
tests/error_001.ts.out
浏览文件 @
9a960b9f
Error: bad
[WILDCARD]
Error: bad
at foo (file://[WILDCARD]tests/error_001.ts:2:9)
at bar (file://[WILDCARD]tests/error_001.ts:6:3)
at eval (file://[WILDCARD]tests/error_001.ts:9:1)
...
...
tests/error_002.test
浏览文件 @
9a960b9f
args
:
tests
/
error_002
.
ts
--
reload
check_stderr
:
true
exit_code
:
1
output
:
tests
/
error_002
.
ts
.
out
tests/error_002.ts.out
浏览文件 @
9a960b9f
Error: exception from mod1
[WILDCARD]
Error: exception from mod1
at throwsError (file://[WILDCARD]/tests/subdir/mod1.ts:16:9)
at foo (file://[WILDCARD]/tests/error_002.ts:4:3)
at eval (file://[WILDCARD]/tests/error_002.ts:7:1)
...
...
tests/error_004_missing_module.test
浏览文件 @
9a960b9f
args
:
tests
/
error_004_missing_module
.
ts
--
reload
check_stderr
:
true
exit_code
:
1
output
:
tests
/
error_004_missing_module
.
ts
.
out
tests/error_004_missing_module.ts.out
浏览文件 @
9a960b9f
NotFound: Cannot resolve module "bad-module.ts" from "[WILDCARD]/tests/error_004_missing_module.ts"
[WILDCARD]
NotFound: Cannot resolve module "bad-module.ts" from "[WILDCARD]/tests/error_004_missing_module.ts"
at DenoError ([WILDCARD]/js/errors.ts:[WILDCARD])
at maybeError ([WILDCARD]/js/errors.ts:[WILDCARD])
at maybeThrowError ([WILDCARD]/js/errors.ts:[WILDCARD])
...
...
tests/error_005_missing_dynamic_import.test
浏览文件 @
9a960b9f
args
:
tests
/
error_005_missing_dynamic_import
.
ts
--
reload
check_stderr
:
true
exit_code
:
1
output
:
tests
/
error_005_missing_dynamic_import
.
ts
.
out
tests/error_005_missing_dynamic_import.ts.out
浏览文件 @
9a960b9f
NotFound: Cannot resolve module "bad-module.ts" from "[WILDCARD]/tests/error_005_missing_dynamic_import.ts"
[WILDCARD]
NotFound: Cannot resolve module "bad-module.ts" from "[WILDCARD]/tests/error_005_missing_dynamic_import.ts"
at DenoError ([WILDCARD]/js/errors.ts:[WILDCARD])
at maybeError ([WILDCARD]/js/errors.ts:[WILDCARD])
at maybeThrowError ([WILDCARD]/js/errors.ts:[WILDCARD])
...
...
tests/error_006_import_ext_failure.test
浏览文件 @
9a960b9f
args
:
tests
/
error_006_import_ext_failure
.
ts
--
reload
check_stderr
:
true
exit_code
:
1
output
:
tests
/
error_006_import_ext_failure
.
ts
.
out
tests/error_006_import_ext_failure.ts.out
浏览文件 @
9a960b9f
NotFound: Cannot resolve module "./non-existent" from "[WILDCARD]/tests/error_006_import_ext_failure.ts"
[WILDCARD]
NotFound: Cannot resolve module "./non-existent" from "[WILDCARD]/tests/error_006_import_ext_failure.ts"
at DenoError ([WILDCARD]/js/errors.ts:[WILDCARD])
at maybeError ([WILDCARD]/js/errors.ts:[WILDCARD])
at maybeThrowError ([WILDCARD]/js/errors.ts:[WILDCARD])
...
...
tests/error_007_any.test
浏览文件 @
9a960b9f
args
:
tests
/
error_007_any
.
ts
--
reload
check_stderr
:
true
exit_code
:
1
output
:
tests
/
error_007_any
.
ts
.
out
tests/error_007_any.ts.out
浏览文件 @
9a960b9f
[object Object]
[
WILDCARD][
object Object]
tests/https_import.ts.out
浏览文件 @
9a960b9f
Downloading https://gist.githubusercontent.com/ry/f12b2aa3409e6b52645bc346a9e22929/raw/79318f239f51d764384a8bded8d7c6a833610dde/print_hello.ts
Hello
tools/integration_tests.py
浏览文件 @
9a960b9f
...
...
@@ -28,6 +28,15 @@ def read_test(file_name):
return
test_dict
def
str2bool
(
v
):
if
v
==
"true"
:
return
True
elif
v
==
"false"
:
return
False
else
:
raise
ValueError
(
"Bad boolean value"
)
def
integration_tests
(
deno_executable
):
assert
os
.
path
.
isfile
(
deno_executable
)
tests
=
sorted
([
...
...
@@ -40,6 +49,10 @@ def integration_tests(deno_executable):
test
=
read_test
(
test_abs
)
exit_code
=
int
(
test
.
get
(
"exit_code"
,
0
))
args
=
test
.
get
(
"args"
,
""
).
split
(
" "
)
check_stderr
=
str2bool
(
test
.
get
(
"check_stderr"
,
"false"
))
stderr
=
subprocess
.
STDOUT
if
check_stderr
else
None
output_abs
=
os
.
path
.
join
(
root_path
,
test
.
get
(
"output"
,
""
))
with
open
(
output_abs
,
'r'
)
as
f
:
expected_out
=
f
.
read
()
...
...
@@ -48,7 +61,8 @@ def integration_tests(deno_executable):
print
" "
.
join
(
cmd
)
actual_code
=
0
try
:
actual_out
=
subprocess
.
check_output
(
cmd
,
universal_newlines
=
True
)
actual_out
=
subprocess
.
check_output
(
cmd
,
universal_newlines
=
True
,
stderr
=
stderr
)
except
subprocess
.
CalledProcessError
as
e
:
actual_code
=
e
.
returncode
actual_out
=
e
.
output
...
...
tools/permission_prompt_test.py
浏览文件 @
9a960b9f
...
...
@@ -79,10 +79,9 @@ class Prompt(object):
assert
stderr
==
b
''
def
test_write_no
(
self
):
code
,
stdout
,
stderr
=
self
.
run
(
'needsWrite'
,
b
'N
\n
'
)
code
,
_
stdout
,
stderr
=
self
.
run
(
'needsWrite'
,
b
'N
\n
'
)
assert
code
==
1
# FIXME this error message should be in stderr
assert
b
'PermissionDenied: permission denied'
in
stdout
assert
b
'PermissionDenied: permission denied'
in
stderr
assert
b
'Deno requests write access'
in
stderr
def
test_env_yes
(
self
):
...
...
@@ -98,10 +97,9 @@ class Prompt(object):
assert
stderr
==
b
''
def
test_env_no
(
self
):
code
,
stdout
,
stderr
=
self
.
run
(
'needsEnv'
,
b
'N
\n
'
)
code
,
_
stdout
,
stderr
=
self
.
run
(
'needsEnv'
,
b
'N
\n
'
)
assert
code
==
1
# FIXME this error message should be in stderr
assert
b
'PermissionDenied: permission denied'
in
stdout
assert
b
'PermissionDenied: permission denied'
in
stderr
assert
b
'Deno requests access to environment'
in
stderr
def
test_net_yes
(
self
):
...
...
@@ -117,10 +115,9 @@ class Prompt(object):
assert
stderr
==
b
''
def
test_net_no
(
self
):
code
,
stdout
,
stderr
=
self
.
run
(
'needsNet'
,
b
'N
\n
'
)
code
,
_
stdout
,
stderr
=
self
.
run
(
'needsNet'
,
b
'N
\n
'
)
assert
code
==
1
# FIXME this error message should be in stderr
assert
b
'PermissionDenied: permission denied'
in
stdout
assert
b
'PermissionDenied: permission denied'
in
stderr
assert
b
'Deno requests network access'
in
stderr
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录