Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
a4fa4ba6
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a4fa4ba6
编写于
1月 07, 2020
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debug: unit tests reorganisation
上级
487122b1
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
209 addition
and
175 deletion
+209
-175
src/vs/workbench/contrib/debug/test/browser/callStack.test.ts
...vs/workbench/contrib/debug/test/browser/callStack.test.ts
+4
-175
src/vs/workbench/contrib/debug/test/browser/repl.test.ts
src/vs/workbench/contrib/debug/test/browser/repl.test.ts
+154
-0
src/vs/workbench/contrib/debug/test/browser/watch.test.ts
src/vs/workbench/contrib/debug/test/browser/watch.test.ts
+51
-0
未找到文件。
src/vs/workbench/contrib/debug/test/browser/
debugModel
.test.ts
→
src/vs/workbench/contrib/debug/test/browser/
callStack
.test.ts
浏览文件 @
a4fa4ba6
...
...
@@ -4,23 +4,19 @@
*--------------------------------------------------------------------------------------------*/
import
*
as
assert
from
'
assert
'
;
import
severity
from
'
vs/base/common/severity
'
;
import
{
DebugModel
,
Expression
,
StackFrame
,
Thread
}
from
'
vs/workbench/contrib/debug/common/debugModel
'
;
import
{
DebugModel
,
StackFrame
,
Thread
}
from
'
vs/workbench/contrib/debug/common/debugModel
'
;
import
*
as
sinon
from
'
sinon
'
;
import
{
MockRawSession
,
MockDebugAdapter
}
from
'
vs/workbench/contrib/debug/test/common/mockDebug
'
;
import
{
MockRawSession
}
from
'
vs/workbench/contrib/debug/test/common/mockDebug
'
;
import
{
Source
}
from
'
vs/workbench/contrib/debug/common/debugSource
'
;
import
{
DebugSession
}
from
'
vs/workbench/contrib/debug/browser/debugSession
'
;
import
{
SimpleReplElement
,
RawObjectReplElement
,
ReplEvaluationInput
,
ReplModel
,
ReplEvaluationResult
}
from
'
vs/workbench/contrib/debug/common/replModel
'
;
import
{
IDebugSessionOptions
}
from
'
vs/workbench/contrib/debug/common/debug
'
;
import
{
NullOpenerService
}
from
'
vs/platform/opener/common/opener
'
;
import
{
RawDebugSession
}
from
'
vs/workbench/contrib/debug/browser/rawDebugSession
'
;
import
{
timeout
}
from
'
vs/base/common/async
'
;
function
createMockSession
(
model
:
DebugModel
,
name
=
'
mockSession
'
,
options
?:
IDebugSessionOptions
):
DebugSession
{
export
function
createMockSession
(
model
:
DebugModel
,
name
=
'
mockSession
'
,
options
?:
IDebugSessionOptions
):
DebugSession
{
return
new
DebugSession
({
resolved
:
{
name
,
type
:
'
node
'
,
request
:
'
launch
'
},
unresolved
:
undefined
},
undefined
!
,
model
,
options
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
NullOpenerService
,
undefined
!
);
}
suite
(
'
Debug -
Model
'
,
()
=>
{
suite
(
'
Debug -
CallStack
'
,
()
=>
{
let
model
:
DebugModel
;
let
rawSession
:
MockRawSession
;
...
...
@@ -217,63 +213,6 @@ suite('Debug - Model', () => {
assert
.
equal
(
session
.
getAllThreads
().
length
,
0
);
});
// Expressions
function
assertWatchExpressions
(
watchExpressions
:
Expression
[],
expectedName
:
string
)
{
assert
.
equal
(
watchExpressions
.
length
,
2
);
watchExpressions
.
forEach
(
we
=>
{
assert
.
equal
(
we
.
available
,
false
);
assert
.
equal
(
we
.
reference
,
0
);
assert
.
equal
(
we
.
name
,
expectedName
);
});
}
test
(
'
watch expressions
'
,
()
=>
{
assert
.
equal
(
model
.
getWatchExpressions
().
length
,
0
);
model
.
addWatchExpression
(
'
console
'
);
model
.
addWatchExpression
(
'
console
'
);
let
watchExpressions
=
model
.
getWatchExpressions
();
assertWatchExpressions
(
watchExpressions
,
'
console
'
);
model
.
renameWatchExpression
(
watchExpressions
[
0
].
getId
(),
'
new_name
'
);
model
.
renameWatchExpression
(
watchExpressions
[
1
].
getId
(),
'
new_name
'
);
assertWatchExpressions
(
model
.
getWatchExpressions
(),
'
new_name
'
);
assertWatchExpressions
(
model
.
getWatchExpressions
(),
'
new_name
'
);
model
.
addWatchExpression
(
'
mockExpression
'
);
model
.
moveWatchExpression
(
model
.
getWatchExpressions
()[
2
].
getId
(),
1
);
watchExpressions
=
model
.
getWatchExpressions
();
assert
.
equal
(
watchExpressions
[
0
].
name
,
'
new_name
'
);
assert
.
equal
(
watchExpressions
[
1
].
name
,
'
mockExpression
'
);
assert
.
equal
(
watchExpressions
[
2
].
name
,
'
new_name
'
);
model
.
removeWatchExpressions
();
assert
.
equal
(
model
.
getWatchExpressions
().
length
,
0
);
});
test
(
'
repl expressions
'
,
()
=>
{
const
session
=
createMockSession
(
model
);
assert
.
equal
(
session
.
getReplElements
().
length
,
0
);
model
.
addSession
(
session
);
session
[
'
raw
'
]
=
<
any
>
rawSession
;
const
thread
=
new
Thread
(
session
,
'
mockthread
'
,
1
);
const
stackFrame
=
new
StackFrame
(
thread
,
1
,
<
any
>
undefined
,
'
app.js
'
,
'
normal
'
,
{
startLineNumber
:
1
,
startColumn
:
1
,
endLineNumber
:
1
,
endColumn
:
10
},
1
);
const
replModel
=
new
ReplModel
();
replModel
.
addReplExpression
(
session
,
stackFrame
,
'
myVariable
'
).
then
();
replModel
.
addReplExpression
(
session
,
stackFrame
,
'
myVariable
'
).
then
();
replModel
.
addReplExpression
(
session
,
stackFrame
,
'
myVariable
'
).
then
();
assert
.
equal
(
replModel
.
getReplElements
().
length
,
3
);
replModel
.
getReplElements
().
forEach
(
re
=>
{
assert
.
equal
((
<
ReplEvaluationInput
>
re
).
value
,
'
myVariable
'
);
});
replModel
.
removeReplExpressions
();
assert
.
equal
(
replModel
.
getReplElements
().
length
,
0
);
});
test
(
'
stack frame get specific source name
'
,
()
=>
{
const
session
=
createMockSession
(
model
);
model
.
addSession
(
session
);
...
...
@@ -341,114 +280,4 @@ suite('Debug - Model', () => {
assert
.
equal
(
sessions
[
4
].
getId
(),
anotherChild
.
getId
());
assert
.
equal
(
sessions
[
5
].
getId
(),
thirdSession
.
getId
());
});
// Repl output
test
(
'
repl output
'
,
()
=>
{
const
session
=
createMockSession
(
model
);
const
repl
=
new
ReplModel
();
repl
.
appendToRepl
(
session
,
'
first line
\n
'
,
severity
.
Error
);
repl
.
appendToRepl
(
session
,
'
second line
'
,
severity
.
Error
);
repl
.
appendToRepl
(
session
,
'
third line
'
,
severity
.
Error
);
repl
.
appendToRepl
(
session
,
'
fourth line
'
,
severity
.
Error
);
let
elements
=
<
SimpleReplElement
[]
>
repl
.
getReplElements
();
assert
.
equal
(
elements
.
length
,
2
);
assert
.
equal
(
elements
[
0
].
value
,
'
first line
\n
'
);
assert
.
equal
(
elements
[
0
].
severity
,
severity
.
Error
);
assert
.
equal
(
elements
[
1
].
value
,
'
second line third line fourth line
'
);
assert
.
equal
(
elements
[
1
].
severity
,
severity
.
Error
);
repl
.
appendToRepl
(
session
,
'
1
'
,
severity
.
Warning
);
elements
=
<
SimpleReplElement
[]
>
repl
.
getReplElements
();
assert
.
equal
(
elements
.
length
,
3
);
assert
.
equal
(
elements
[
2
].
value
,
'
1
'
);
assert
.
equal
(
elements
[
2
].
severity
,
severity
.
Warning
);
const
keyValueObject
=
{
'
key1
'
:
2
,
'
key2
'
:
'
value
'
};
repl
.
appendToRepl
(
session
,
new
RawObjectReplElement
(
'
fakeid
'
,
'
fake
'
,
keyValueObject
),
severity
.
Info
);
const
element
=
<
RawObjectReplElement
>
repl
.
getReplElements
()[
3
];
assert
.
equal
(
element
.
value
,
'
Object
'
);
assert
.
deepEqual
(
element
.
valueObj
,
keyValueObject
);
repl
.
removeReplExpressions
();
assert
.
equal
(
repl
.
getReplElements
().
length
,
0
);
repl
.
appendToRepl
(
session
,
'
1
\n
'
,
severity
.
Info
);
repl
.
appendToRepl
(
session
,
'
2
'
,
severity
.
Info
);
repl
.
appendToRepl
(
session
,
'
3
\n
4
'
,
severity
.
Info
);
repl
.
appendToRepl
(
session
,
'
5
\n
'
,
severity
.
Info
);
repl
.
appendToRepl
(
session
,
'
6
'
,
severity
.
Info
);
elements
=
<
SimpleReplElement
[]
>
repl
.
getReplElements
();
assert
.
equal
(
elements
.
length
,
3
);
assert
.
equal
(
elements
[
0
],
'
1
\n
'
);
assert
.
equal
(
elements
[
1
],
'
23
\n
45
\n
'
);
assert
.
equal
(
elements
[
2
],
'
6
'
);
});
test
(
'
repl merging
'
,
()
=>
{
// 'mergeWithParent' should be ignored when there is no parent.
const
parent
=
createMockSession
(
model
,
'
parent
'
,
{
repl
:
'
mergeWithParent
'
});
const
child1
=
createMockSession
(
model
,
'
child1
'
,
{
parentSession
:
parent
,
repl
:
'
separate
'
});
const
child2
=
createMockSession
(
model
,
'
child2
'
,
{
parentSession
:
parent
,
repl
:
'
mergeWithParent
'
});
const
grandChild
=
createMockSession
(
model
,
'
grandChild
'
,
{
parentSession
:
child2
,
repl
:
'
mergeWithParent
'
});
const
child3
=
createMockSession
(
model
,
'
child3
'
,
{
parentSession
:
parent
});
let
parentChanges
=
0
;
parent
.
onDidChangeReplElements
(()
=>
++
parentChanges
);
parent
.
appendToRepl
(
'
1
\n
'
,
severity
.
Info
);
assert
.
equal
(
parentChanges
,
1
);
assert
.
equal
(
parent
.
getReplElements
().
length
,
1
);
assert
.
equal
(
child1
.
getReplElements
().
length
,
0
);
assert
.
equal
(
child2
.
getReplElements
().
length
,
1
);
assert
.
equal
(
grandChild
.
getReplElements
().
length
,
1
);
assert
.
equal
(
child3
.
getReplElements
().
length
,
0
);
grandChild
.
appendToRepl
(
'
1
\n
'
,
severity
.
Info
);
assert
.
equal
(
parentChanges
,
2
);
assert
.
equal
(
parent
.
getReplElements
().
length
,
2
);
assert
.
equal
(
child1
.
getReplElements
().
length
,
0
);
assert
.
equal
(
child2
.
getReplElements
().
length
,
2
);
assert
.
equal
(
grandChild
.
getReplElements
().
length
,
2
);
assert
.
equal
(
child3
.
getReplElements
().
length
,
0
);
child3
.
appendToRepl
(
'
1
\n
'
,
severity
.
Info
);
assert
.
equal
(
parentChanges
,
2
);
assert
.
equal
(
parent
.
getReplElements
().
length
,
2
);
assert
.
equal
(
child1
.
getReplElements
().
length
,
0
);
assert
.
equal
(
child2
.
getReplElements
().
length
,
2
);
assert
.
equal
(
grandChild
.
getReplElements
().
length
,
2
);
assert
.
equal
(
child3
.
getReplElements
().
length
,
1
);
child1
.
appendToRepl
(
'
1
\n
'
,
severity
.
Info
);
assert
.
equal
(
parentChanges
,
2
);
assert
.
equal
(
parent
.
getReplElements
().
length
,
2
);
assert
.
equal
(
child1
.
getReplElements
().
length
,
1
);
assert
.
equal
(
child2
.
getReplElements
().
length
,
2
);
assert
.
equal
(
grandChild
.
getReplElements
().
length
,
2
);
assert
.
equal
(
child3
.
getReplElements
().
length
,
1
);
});
test
(
'
repl ordering
'
,
async
()
=>
{
const
session
=
createMockSession
(
model
);
model
.
addSession
(
session
);
const
adapter
=
new
MockDebugAdapter
();
const
raw
=
new
RawDebugSession
(
adapter
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
);
session
.
initializeForTest
(
raw
);
await
session
.
addReplExpression
(
undefined
,
'
before.1
'
);
assert
.
equal
(
session
.
getReplElements
().
length
,
3
);
assert
.
equal
((
<
ReplEvaluationInput
>
session
.
getReplElements
()[
0
]).
value
,
'
before.1
'
);
assert
.
equal
((
<
SimpleReplElement
>
session
.
getReplElements
()[
1
]).
value
,
'
before.1
'
);
assert
.
equal
((
<
ReplEvaluationResult
>
session
.
getReplElements
()[
2
]).
value
,
'
=before.1
'
);
await
session
.
addReplExpression
(
undefined
,
'
after.2
'
);
await
timeout
(
0
);
assert
.
equal
(
session
.
getReplElements
().
length
,
6
);
assert
.
equal
((
<
ReplEvaluationInput
>
session
.
getReplElements
()[
3
]).
value
,
'
after.2
'
);
assert
.
equal
((
<
ReplEvaluationResult
>
session
.
getReplElements
()[
4
]).
value
,
'
=after.2
'
);
assert
.
equal
((
<
SimpleReplElement
>
session
.
getReplElements
()[
5
]).
value
,
'
after.2
'
);
});
});
src/vs/workbench/contrib/debug/test/browser/repl.test.ts
0 → 100644
浏览文件 @
a4fa4ba6
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
*
as
assert
from
'
assert
'
;
import
severity
from
'
vs/base/common/severity
'
;
import
{
DebugModel
,
StackFrame
,
Thread
}
from
'
vs/workbench/contrib/debug/common/debugModel
'
;
import
{
MockRawSession
,
MockDebugAdapter
}
from
'
vs/workbench/contrib/debug/test/common/mockDebug
'
;
import
{
SimpleReplElement
,
RawObjectReplElement
,
ReplEvaluationInput
,
ReplModel
,
ReplEvaluationResult
}
from
'
vs/workbench/contrib/debug/common/replModel
'
;
import
{
RawDebugSession
}
from
'
vs/workbench/contrib/debug/browser/rawDebugSession
'
;
import
{
timeout
}
from
'
vs/base/common/async
'
;
import
{
createMockSession
}
from
'
vs/workbench/contrib/debug/test/browser/callStack.test
'
;
suite
(
'
Debug - REPL
'
,
()
=>
{
let
model
:
DebugModel
;
let
rawSession
:
MockRawSession
;
setup
(()
=>
{
model
=
new
DebugModel
([],
[],
[],
[],
[],
<
any
>
{
isDirty
:
(
e
:
any
)
=>
false
});
rawSession
=
new
MockRawSession
();
});
test
(
'
repl output
'
,
()
=>
{
const
session
=
createMockSession
(
model
);
const
repl
=
new
ReplModel
();
repl
.
appendToRepl
(
session
,
'
first line
\n
'
,
severity
.
Error
);
repl
.
appendToRepl
(
session
,
'
second line
'
,
severity
.
Error
);
repl
.
appendToRepl
(
session
,
'
third line
'
,
severity
.
Error
);
repl
.
appendToRepl
(
session
,
'
fourth line
'
,
severity
.
Error
);
let
elements
=
<
SimpleReplElement
[]
>
repl
.
getReplElements
();
assert
.
equal
(
elements
.
length
,
2
);
assert
.
equal
(
elements
[
0
].
value
,
'
first line
\n
'
);
assert
.
equal
(
elements
[
0
].
severity
,
severity
.
Error
);
assert
.
equal
(
elements
[
1
].
value
,
'
second line third line fourth line
'
);
assert
.
equal
(
elements
[
1
].
severity
,
severity
.
Error
);
repl
.
appendToRepl
(
session
,
'
1
'
,
severity
.
Warning
);
elements
=
<
SimpleReplElement
[]
>
repl
.
getReplElements
();
assert
.
equal
(
elements
.
length
,
3
);
assert
.
equal
(
elements
[
2
].
value
,
'
1
'
);
assert
.
equal
(
elements
[
2
].
severity
,
severity
.
Warning
);
const
keyValueObject
=
{
'
key1
'
:
2
,
'
key2
'
:
'
value
'
};
repl
.
appendToRepl
(
session
,
new
RawObjectReplElement
(
'
fakeid
'
,
'
fake
'
,
keyValueObject
),
severity
.
Info
);
const
element
=
<
RawObjectReplElement
>
repl
.
getReplElements
()[
3
];
assert
.
equal
(
element
.
value
,
'
Object
'
);
assert
.
deepEqual
(
element
.
valueObj
,
keyValueObject
);
repl
.
removeReplExpressions
();
assert
.
equal
(
repl
.
getReplElements
().
length
,
0
);
repl
.
appendToRepl
(
session
,
'
1
\n
'
,
severity
.
Info
);
repl
.
appendToRepl
(
session
,
'
2
'
,
severity
.
Info
);
repl
.
appendToRepl
(
session
,
'
3
\n
4
'
,
severity
.
Info
);
repl
.
appendToRepl
(
session
,
'
5
\n
'
,
severity
.
Info
);
repl
.
appendToRepl
(
session
,
'
6
'
,
severity
.
Info
);
elements
=
<
SimpleReplElement
[]
>
repl
.
getReplElements
();
assert
.
equal
(
elements
.
length
,
3
);
assert
.
equal
(
elements
[
0
],
'
1
\n
'
);
assert
.
equal
(
elements
[
1
],
'
23
\n
45
\n
'
);
assert
.
equal
(
elements
[
2
],
'
6
'
);
});
test
(
'
repl merging
'
,
()
=>
{
// 'mergeWithParent' should be ignored when there is no parent.
const
parent
=
createMockSession
(
model
,
'
parent
'
,
{
repl
:
'
mergeWithParent
'
});
const
child1
=
createMockSession
(
model
,
'
child1
'
,
{
parentSession
:
parent
,
repl
:
'
separate
'
});
const
child2
=
createMockSession
(
model
,
'
child2
'
,
{
parentSession
:
parent
,
repl
:
'
mergeWithParent
'
});
const
grandChild
=
createMockSession
(
model
,
'
grandChild
'
,
{
parentSession
:
child2
,
repl
:
'
mergeWithParent
'
});
const
child3
=
createMockSession
(
model
,
'
child3
'
,
{
parentSession
:
parent
});
let
parentChanges
=
0
;
parent
.
onDidChangeReplElements
(()
=>
++
parentChanges
);
parent
.
appendToRepl
(
'
1
\n
'
,
severity
.
Info
);
assert
.
equal
(
parentChanges
,
1
);
assert
.
equal
(
parent
.
getReplElements
().
length
,
1
);
assert
.
equal
(
child1
.
getReplElements
().
length
,
0
);
assert
.
equal
(
child2
.
getReplElements
().
length
,
1
);
assert
.
equal
(
grandChild
.
getReplElements
().
length
,
1
);
assert
.
equal
(
child3
.
getReplElements
().
length
,
0
);
grandChild
.
appendToRepl
(
'
1
\n
'
,
severity
.
Info
);
assert
.
equal
(
parentChanges
,
2
);
assert
.
equal
(
parent
.
getReplElements
().
length
,
2
);
assert
.
equal
(
child1
.
getReplElements
().
length
,
0
);
assert
.
equal
(
child2
.
getReplElements
().
length
,
2
);
assert
.
equal
(
grandChild
.
getReplElements
().
length
,
2
);
assert
.
equal
(
child3
.
getReplElements
().
length
,
0
);
child3
.
appendToRepl
(
'
1
\n
'
,
severity
.
Info
);
assert
.
equal
(
parentChanges
,
2
);
assert
.
equal
(
parent
.
getReplElements
().
length
,
2
);
assert
.
equal
(
child1
.
getReplElements
().
length
,
0
);
assert
.
equal
(
child2
.
getReplElements
().
length
,
2
);
assert
.
equal
(
grandChild
.
getReplElements
().
length
,
2
);
assert
.
equal
(
child3
.
getReplElements
().
length
,
1
);
child1
.
appendToRepl
(
'
1
\n
'
,
severity
.
Info
);
assert
.
equal
(
parentChanges
,
2
);
assert
.
equal
(
parent
.
getReplElements
().
length
,
2
);
assert
.
equal
(
child1
.
getReplElements
().
length
,
1
);
assert
.
equal
(
child2
.
getReplElements
().
length
,
2
);
assert
.
equal
(
grandChild
.
getReplElements
().
length
,
2
);
assert
.
equal
(
child3
.
getReplElements
().
length
,
1
);
});
test
(
'
repl expressions
'
,
()
=>
{
const
session
=
createMockSession
(
model
);
assert
.
equal
(
session
.
getReplElements
().
length
,
0
);
model
.
addSession
(
session
);
session
[
'
raw
'
]
=
<
any
>
rawSession
;
const
thread
=
new
Thread
(
session
,
'
mockthread
'
,
1
);
const
stackFrame
=
new
StackFrame
(
thread
,
1
,
<
any
>
undefined
,
'
app.js
'
,
'
normal
'
,
{
startLineNumber
:
1
,
startColumn
:
1
,
endLineNumber
:
1
,
endColumn
:
10
},
1
);
const
replModel
=
new
ReplModel
();
replModel
.
addReplExpression
(
session
,
stackFrame
,
'
myVariable
'
).
then
();
replModel
.
addReplExpression
(
session
,
stackFrame
,
'
myVariable
'
).
then
();
replModel
.
addReplExpression
(
session
,
stackFrame
,
'
myVariable
'
).
then
();
assert
.
equal
(
replModel
.
getReplElements
().
length
,
3
);
replModel
.
getReplElements
().
forEach
(
re
=>
{
assert
.
equal
((
<
ReplEvaluationInput
>
re
).
value
,
'
myVariable
'
);
});
replModel
.
removeReplExpressions
();
assert
.
equal
(
replModel
.
getReplElements
().
length
,
0
);
});
test
(
'
repl ordering
'
,
async
()
=>
{
const
session
=
createMockSession
(
model
);
model
.
addSession
(
session
);
const
adapter
=
new
MockDebugAdapter
();
const
raw
=
new
RawDebugSession
(
adapter
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
,
undefined
!
);
session
.
initializeForTest
(
raw
);
await
session
.
addReplExpression
(
undefined
,
'
before.1
'
);
assert
.
equal
(
session
.
getReplElements
().
length
,
3
);
assert
.
equal
((
<
ReplEvaluationInput
>
session
.
getReplElements
()[
0
]).
value
,
'
before.1
'
);
assert
.
equal
((
<
SimpleReplElement
>
session
.
getReplElements
()[
1
]).
value
,
'
before.1
'
);
assert
.
equal
((
<
ReplEvaluationResult
>
session
.
getReplElements
()[
2
]).
value
,
'
=before.1
'
);
await
session
.
addReplExpression
(
undefined
,
'
after.2
'
);
await
timeout
(
0
);
assert
.
equal
(
session
.
getReplElements
().
length
,
6
);
assert
.
equal
((
<
ReplEvaluationInput
>
session
.
getReplElements
()[
3
]).
value
,
'
after.2
'
);
assert
.
equal
((
<
ReplEvaluationResult
>
session
.
getReplElements
()[
4
]).
value
,
'
=after.2
'
);
assert
.
equal
((
<
SimpleReplElement
>
session
.
getReplElements
()[
5
]).
value
,
'
after.2
'
);
});
});
src/vs/workbench/contrib/debug/test/browser/watch.test.ts
0 → 100644
浏览文件 @
a4fa4ba6
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
*
as
assert
from
'
assert
'
;
import
{
Expression
,
DebugModel
}
from
'
vs/workbench/contrib/debug/common/debugModel
'
;
// Expressions
function
assertWatchExpressions
(
watchExpressions
:
Expression
[],
expectedName
:
string
)
{
assert
.
equal
(
watchExpressions
.
length
,
2
);
watchExpressions
.
forEach
(
we
=>
{
assert
.
equal
(
we
.
available
,
false
);
assert
.
equal
(
we
.
reference
,
0
);
assert
.
equal
(
we
.
name
,
expectedName
);
});
}
suite
(
'
Debug - Watch
'
,
()
=>
{
let
model
:
DebugModel
;
setup
(()
=>
{
model
=
new
DebugModel
([],
[],
[],
[],
[],
<
any
>
{
isDirty
:
(
e
:
any
)
=>
false
});
});
test
(
'
watch expressions
'
,
()
=>
{
assert
.
equal
(
model
.
getWatchExpressions
().
length
,
0
);
model
.
addWatchExpression
(
'
console
'
);
model
.
addWatchExpression
(
'
console
'
);
let
watchExpressions
=
model
.
getWatchExpressions
();
assertWatchExpressions
(
watchExpressions
,
'
console
'
);
model
.
renameWatchExpression
(
watchExpressions
[
0
].
getId
(),
'
new_name
'
);
model
.
renameWatchExpression
(
watchExpressions
[
1
].
getId
(),
'
new_name
'
);
assertWatchExpressions
(
model
.
getWatchExpressions
(),
'
new_name
'
);
assertWatchExpressions
(
model
.
getWatchExpressions
(),
'
new_name
'
);
model
.
addWatchExpression
(
'
mockExpression
'
);
model
.
moveWatchExpression
(
model
.
getWatchExpressions
()[
2
].
getId
(),
1
);
watchExpressions
=
model
.
getWatchExpressions
();
assert
.
equal
(
watchExpressions
[
0
].
name
,
'
new_name
'
);
assert
.
equal
(
watchExpressions
[
1
].
name
,
'
mockExpression
'
);
assert
.
equal
(
watchExpressions
[
2
].
name
,
'
new_name
'
);
model
.
removeWatchExpressions
();
assert
.
equal
(
model
.
getWatchExpressions
().
length
,
0
);
});
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录