Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
254e5725
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
254e5725
编写于
9月 09, 2015
作者:
A
Andrew Casey
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5102 from amcasey/RemoveStep
Eliminate history test helpers
上级
6d155f1e
ef155a6d
变更
2
展开全部
隐藏空白更改
内联
并排
Showing
2 changed file
with
240 addition
and
320 deletion
+240
-320
src/InteractiveWindow/EditorTest/HistoryTests.cs
src/InteractiveWindow/EditorTest/HistoryTests.cs
+56
-89
src/InteractiveWindow/EditorTest/InteractiveWindowHistoryTests.cs
...ractiveWindow/EditorTest/InteractiveWindowHistoryTests.cs
+184
-231
未找到文件。
src/InteractiveWindow/EditorTest/HistoryTests.cs
浏览文件 @
254e5725
...
...
@@ -114,12 +114,11 @@ public void TestPrevious()
{
AddEntries
(
"1"
,
"2"
,
"3"
);
Test
(
new
Step
(()
=>
_history
.
GetPrevious
(
null
),
"3"
),
new
Step
(()
=>
_history
.
GetPrevious
(
null
),
"2"
),
new
Step
(()
=>
_history
.
GetPrevious
(
null
),
"1"
),
new
Step
(()
=>
_history
.
GetPrevious
(
null
),
null
),
new
Step
(()
=>
_history
.
GetPrevious
(
null
),
null
));
CheckHistoryText
(
_history
.
GetPrevious
(
null
),
"3"
);
CheckHistoryText
(
_history
.
GetPrevious
(
null
),
"2"
);
CheckHistoryText
(
_history
.
GetPrevious
(
null
),
"1"
);
CheckHistoryText
(
_history
.
GetPrevious
(
null
),
null
);
CheckHistoryText
(
_history
.
GetPrevious
(
null
),
null
);
}
[
Fact
]
...
...
@@ -127,17 +126,16 @@ public void TestNext()
{
AddEntries
(
"1"
,
"2"
,
"3"
);
Test
(
new
Step
(()
=>
_history
.
GetNext
(
null
),
null
),
new
Step
(()
=>
_history
.
GetNext
(
null
),
null
),
new
Step
(()
=>
_history
.
GetPrevious
(
null
),
"3"
),
new
Step
(()
=>
_history
.
GetPrevious
(
null
),
"2"
),
new
Step
(()
=>
_history
.
GetPrevious
(
null
),
"1"
),
new
Step
(()
=>
_history
.
GetPrevious
(
null
),
null
),
new
Step
(()
=>
_history
.
GetNext
(
null
),
"2"
),
new
Step
(()
=>
_history
.
GetNext
(
null
),
"3"
),
new
Step
(()
=>
_history
.
GetNext
(
null
),
null
),
new
Step
(()
=>
_history
.
GetNext
(
null
),
null
));
CheckHistoryText
(
_history
.
GetNext
(
null
),
null
);
CheckHistoryText
(
_history
.
GetNext
(
null
),
null
);
CheckHistoryText
(
_history
.
GetPrevious
(
null
),
"3"
);
CheckHistoryText
(
_history
.
GetPrevious
(
null
),
"2"
);
CheckHistoryText
(
_history
.
GetPrevious
(
null
),
"1"
);
CheckHistoryText
(
_history
.
GetPrevious
(
null
),
null
);
CheckHistoryText
(
_history
.
GetNext
(
null
),
"2"
);
CheckHistoryText
(
_history
.
GetNext
(
null
),
"3"
);
CheckHistoryText
(
_history
.
GetNext
(
null
),
null
);
CheckHistoryText
(
_history
.
GetNext
(
null
),
null
);
}
[
Fact
]
...
...
@@ -145,9 +143,8 @@ public void TestPreviousWithPattern_NoMatch()
{
AddEntries
(
"123"
,
"12"
,
"1"
);
Test
(
new
Step
(()
=>
_history
.
GetPrevious
(
"4"
),
null
),
new
Step
(()
=>
_history
.
GetPrevious
(
"4"
),
null
));
CheckHistoryText
(
_history
.
GetPrevious
(
"4"
),
null
);
CheckHistoryText
(
_history
.
GetPrevious
(
"4"
),
null
);
}
[
Fact
]
...
...
@@ -155,10 +152,9 @@ public void TestPreviousWithPattern_PatternMaintained()
{
AddEntries
(
"123"
,
"12"
,
"1"
);
Test
(
new
Step
(()
=>
_history
.
GetPrevious
(
"12"
),
"12"
),
// Skip over non-matching entry.
new
Step
(()
=>
_history
.
GetPrevious
(
"12"
),
"123"
),
new
Step
(()
=>
_history
.
GetPrevious
(
"12"
),
null
));
CheckHistoryText
(
_history
.
GetPrevious
(
"12"
),
"12"
);
// Skip over non-matching entry.
CheckHistoryText
(
_history
.
GetPrevious
(
"12"
),
"123"
);
CheckHistoryText
(
_history
.
GetPrevious
(
"12"
),
null
);
}
[
Fact
]
...
...
@@ -166,10 +162,9 @@ public void TestPreviousWithPattern_PatternDropped()
{
AddEntries
(
"1"
,
"2"
,
"3"
);
Test
(
new
Step
(()
=>
_history
.
GetPrevious
(
"2"
),
"2"
),
// Skip over non-matching entry.
new
Step
(()
=>
_history
.
GetPrevious
(
null
),
"1"
),
// Pattern isn't passed, so return to normal iteration.
new
Step
(()
=>
_history
.
GetPrevious
(
null
),
null
));
CheckHistoryText
(
_history
.
GetPrevious
(
"2"
),
"2"
);
// Skip over non-matching entry.
CheckHistoryText
(
_history
.
GetPrevious
(
null
),
"1"
);
// Pattern isn't passed, so return to normal iteration.
CheckHistoryText
(
_history
.
GetPrevious
(
null
),
null
);
}
[
Fact
]
...
...
@@ -177,10 +172,9 @@ public void TestPreviousWithPattern_PatternChanged()
{
AddEntries
(
"1a"
,
"2a"
,
"1b"
,
"2b"
);
Test
(
new
Step
(()
=>
_history
.
GetPrevious
(
"1"
),
"1b"
),
// Skip over non-matching entry.
new
Step
(()
=>
_history
.
GetPrevious
(
"2"
),
"2a"
),
// Skip over non-matching entry.
new
Step
(()
=>
_history
.
GetPrevious
(
"2"
),
null
));
CheckHistoryText
(
_history
.
GetPrevious
(
"1"
),
"1b"
);
// Skip over non-matching entry.
CheckHistoryText
(
_history
.
GetPrevious
(
"2"
),
"2a"
);
// Skip over non-matching entry.
CheckHistoryText
(
_history
.
GetPrevious
(
"2"
),
null
);
}
[
Fact
]
...
...
@@ -188,14 +182,13 @@ public void TestNextWithPattern_NoMatch()
{
AddEntries
(
"start"
,
"1"
,
"12"
,
"123"
);
Test
(
new
Step
(()
=>
_history
.
GetPrevious
(
null
),
"123"
),
new
Step
(()
=>
_history
.
GetPrevious
(
null
),
"12"
),
new
Step
(()
=>
_history
.
GetPrevious
(
null
),
"1"
),
new
Step
(()
=>
_history
.
GetPrevious
(
null
),
"start"
),
CheckHistoryText
(
_history
.
GetPrevious
(
null
),
"123"
);
CheckHistoryText
(
_history
.
GetPrevious
(
null
),
"12"
);
CheckHistoryText
(
_history
.
GetPrevious
(
null
),
"1"
);
CheckHistoryText
(
_history
.
GetPrevious
(
null
),
"start"
);
new
Step
(()
=>
_history
.
GetNext
(
"4"
),
null
),
new
Step
(()
=>
_history
.
GetNext
(
"4"
),
null
)
);
CheckHistoryText
(
_history
.
GetNext
(
"4"
),
null
);
CheckHistoryText
(
_history
.
GetNext
(
"4"
),
null
);
}
[
Fact
]
...
...
@@ -203,15 +196,14 @@ public void TestNextWithPattern_PatternMaintained()
{
AddEntries
(
"start"
,
"1"
,
"12"
,
"123"
);
Test
(
new
Step
(()
=>
_history
.
GetPrevious
(
null
),
"123"
),
new
Step
(()
=>
_history
.
GetPrevious
(
null
),
"12"
),
new
Step
(()
=>
_history
.
GetPrevious
(
null
),
"1"
),
new
Step
(()
=>
_history
.
GetPrevious
(
null
),
"start"
),
CheckHistoryText
(
_history
.
GetPrevious
(
null
),
"123"
);
CheckHistoryText
(
_history
.
GetPrevious
(
null
),
"12"
);
CheckHistoryText
(
_history
.
GetPrevious
(
null
),
"1"
);
CheckHistoryText
(
_history
.
GetPrevious
(
null
),
"start"
);
new
Step
(()
=>
_history
.
GetNext
(
"12"
),
"12"
),
// Skip over non-matching entry.
new
Step
(()
=>
_history
.
GetNext
(
"12"
),
"123"
),
new
Step
(()
=>
_history
.
GetNext
(
"12"
),
null
)
);
CheckHistoryText
(
_history
.
GetNext
(
"12"
),
"12"
);
// Skip over non-matching entry.
CheckHistoryText
(
_history
.
GetNext
(
"12"
),
"123"
);
CheckHistoryText
(
_history
.
GetNext
(
"12"
),
null
);
}
[
Fact
]
...
...
@@ -219,15 +211,14 @@ public void TestNextWithPattern_PatternDropped()
{
AddEntries
(
"start"
,
"3"
,
"2"
,
"1"
);
Test
(
new
Step
(()
=>
_history
.
GetPrevious
(
null
),
"1"
),
new
Step
(()
=>
_history
.
GetPrevious
(
null
),
"2"
),
new
Step
(()
=>
_history
.
GetPrevious
(
null
),
"3"
),
new
Step
(()
=>
_history
.
GetPrevious
(
null
),
"start"
),
CheckHistoryText
(
_history
.
GetPrevious
(
null
),
"1"
);
CheckHistoryText
(
_history
.
GetPrevious
(
null
),
"2"
);
CheckHistoryText
(
_history
.
GetPrevious
(
null
),
"3"
);
CheckHistoryText
(
_history
.
GetPrevious
(
null
),
"start"
);
new
Step
(()
=>
_history
.
GetNext
(
"2"
),
"2"
),
// Skip over non-matching entry.
new
Step
(()
=>
_history
.
GetNext
(
null
),
"1"
),
// Pattern isn't passed, so return to normal iteration.
new
Step
(()
=>
_history
.
GetNext
(
null
),
null
)
);
CheckHistoryText
(
_history
.
GetNext
(
"2"
),
"2"
);
// Skip over non-matching entry.
CheckHistoryText
(
_history
.
GetNext
(
null
),
"1"
);
// Pattern isn't passed, so return to normal iteration.
CheckHistoryText
(
_history
.
GetNext
(
null
),
null
);
}
[
Fact
]
...
...
@@ -235,16 +226,15 @@ public void TestNextWithPattern_PatternChanged()
{
AddEntries
(
"start"
,
"2b"
,
"1b"
,
"2a"
,
"1a"
);
Test
(
new
Step
(()
=>
_history
.
GetPrevious
(
null
),
"1a"
),
new
Step
(()
=>
_history
.
GetPrevious
(
null
),
"2a"
),
new
Step
(()
=>
_history
.
GetPrevious
(
null
),
"1b"
),
new
Step
(()
=>
_history
.
GetPrevious
(
null
),
"2b"
),
new
Step
(()
=>
_history
.
GetPrevious
(
null
),
"start"
),
CheckHistoryText
(
_history
.
GetPrevious
(
null
),
"1a"
);
CheckHistoryText
(
_history
.
GetPrevious
(
null
),
"2a"
);
CheckHistoryText
(
_history
.
GetPrevious
(
null
),
"1b"
);
CheckHistoryText
(
_history
.
GetPrevious
(
null
),
"2b"
);
CheckHistoryText
(
_history
.
GetPrevious
(
null
),
"start"
);
new
Step
(()
=>
_history
.
GetNext
(
"1"
),
"1b"
),
// Skip over non-matching entry.
new
Step
(()
=>
_history
.
GetNext
(
"2"
),
"2a"
),
// Skip over non-matching entry.
new
Step
(()
=>
_history
.
GetNext
(
"2"
),
null
)
);
CheckHistoryText
(
_history
.
GetNext
(
"1"
),
"1b"
);
// Skip over non-matching entry.
CheckHistoryText
(
_history
.
GetNext
(
"2"
),
"2a"
);
// Skip over non-matching entry.
CheckHistoryText
(
_history
.
GetNext
(
"2"
),
null
);
}
private
void
AddEntries
(
params
string
[]
entries
)
...
...
@@ -277,32 +267,9 @@ private static IEnumerable<string> GetHistoryEntries(History history)
return
history
.
Items
.
Select
(
e
=>
e
.
Text
);
}
private
void
Test
(
params
Step
[]
steps
)
private
void
CheckHistoryText
(
History
.
Entry
actualEntry
,
string
expectedText
)
{
int
i
=
0
;
foreach
(
var
step
in
steps
)
{
var
actualEntry
=
step
.
Func
();
var
expected
=
step
.
ExpectedText
;
var
actual
=
actualEntry
?.
Text
;
if
(
expected
!=
actual
)
{
Assert
.
False
(
true
,
$"Step
{
i
}
: expected '
{
expected
??
"null"
}
', but found '
{
actual
??
"null"
}
'"
);
}
i
++;
}
}
private
struct
Step
{
public
readonly
Func
<
History
.
Entry
>
Func
;
public
readonly
string
ExpectedText
;
public
Step
(
Func
<
History
.
Entry
>
func
,
string
expectedText
)
{
Func
=
func
;
ExpectedText
=
expectedText
;
}
Assert
.
Equal
(
expectedText
,
actualEntry
?.
Text
);
}
}
}
\ No newline at end of file
src/InteractiveWindow/EditorTest/InteractiveWindowHistoryTests.cs
浏览文件 @
254e5725
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录