Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
c8bfdaea
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,发现更多精彩内容 >>
提交
c8bfdaea
编写于
4月 23, 2017
作者:
C
CyrusNajmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add tests to validate spans are returned when falling back from current culture to english.
上级
f16bfa43
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
27 addition
and
9 deletion
+27
-9
src/EditorFeatures/Test2/IntelliSense/CompletionRulesTests.vb
...EditorFeatures/Test2/IntelliSense/CompletionRulesTests.vb
+27
-9
未找到文件。
src/EditorFeatures/Test2/IntelliSense/CompletionRulesTests.vb
浏览文件 @
c8bfdaea
...
...
@@ -3,6 +3,7 @@
Imports
System.Globalization
Imports
Microsoft.CodeAnalysis.Completion
Imports
Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces
Imports
Microsoft.CodeAnalysis.Text
Namespace
Microsoft.CodeAnalysis.Editor.UnitTests.IntelliSense
' These tests adapted from David Kean's table at
...
...
@@ -10,7 +11,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.IntelliSense
Public
Class
CompletionRulesTests
<
Fact
>
Public
Sub
TestMatchLowerCaseEnglishI
()
Dim
wordsToMatch
=
{
"
index"
,
"Index"
,
"işte"
,
"İ
şte"
}
Dim
wordsToMatch
=
{
"
[|i|]ndex"
,
"[|I|]ndex"
,
"[|i|]şte"
,
"[|İ|]
şte"
}
Dim
wordsToNotMatch
=
{
"ırak"
}
TestMatches
(
"i"
,
wordsToMatch
)
...
...
@@ -19,7 +20,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.IntelliSense
<
Fact
>
Public
Sub
TestMatchDottedUpperTurkishI
()
Dim
wordsToMatch
=
{
"
index"
,
"işte"
,
"İ
şte"
}
Dim
wordsToMatch
=
{
"
[|i|]ndex"
,
"[|i|]şte"
,
"[|İ|]
şte"
}
Dim
wordsToNotMatch
=
{
"ırak"
,
"Irak"
,
"Index"
}
TestMatches
(
"İ"
,
wordsToMatch
)
...
...
@@ -28,7 +29,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.IntelliSense
<
Fact
>
Public
Sub
TestMatchNonDottedLowerTurkishI
()
Dim
wordsToMatch
=
{
"
ırak"
,
"I
rak"
}
Dim
wordsToMatch
=
{
"
[|ı|]rak"
,
"[|I|]
rak"
}
Dim
wordsToNotMatch
=
{
"index"
,
"işte"
,
"İşte"
}
TestMatches
(
"ı"
,
wordsToMatch
)
...
...
@@ -37,31 +38,48 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.IntelliSense
<
Fact
>
Public
Sub
TestMatchEnglishUpperI
()
Dim
wordsToMatch
=
{
"Index"
,
"index"
,
"ırak"
,
"Irak"
}
' In turkish-culture "I" will not match "index". However, we want to verify that
' the underlying completion helper will fallback to doing an en-us check if the
' tr-tr check fails, and that it properly also returns the matched spans in this case.
Dim
wordsToMatch
=
{
"[|I|]ndex"
,
"[|i|]ndex"
,
"[|ı|]rak"
,
"[|I|]rak"
}
Dim
wordsToNotMatch
=
{
"İşte"
}
TestMatches
(
"I"
,
wordsToMatch
)
TestNotMatches
(
"I"
,
wordsToNotMatch
)
End
Sub
Private
Sub
TestMatches
(
v
As
String
,
wordsToMatch
()
As
String
)
Private
Sub
TestMatches
(
pattern
As
String
,
wordsToMatch
()
As
String
)
Dim
culture
=
New
CultureInfo
(
"tr-TR"
,
useUserOverride
:
=
False
)
Dim
workspace
=
New
TestWorkspace
Dim
helper
=
CompletionHelper
.
GetHelper
(
workspace
,
LanguageNames
.
CSharp
)
For
Each
word
In
wordsToMatch
For
Each
wordMarkup
In
wordsToMatch
Dim
word
As
String
=
Nothing
Dim
wordMatchSpan
As
TextSpan
=
Nothing
MarkupTestFile
.
GetSpan
(
wordMarkup
,
word
,
wordMatchSpan
)
Dim
item
=
CompletionItem
.
Create
(
word
)
Assert
.
True
(
helper
.
MatchesPattern
(
item
.
FilterText
,
v
,
culture
),
$
"Expected item {word} does not match {v}"
)
Assert
.
True
(
helper
.
MatchesPattern
(
item
.
FilterText
,
pattern
,
culture
),
$
"Expected item {word} does not match {pattern}"
)
Dim
highlightedSpans
=
helper
.
GetHighlightedSpans
(
item
.
FilterText
,
pattern
,
culture
)
Assert
.
NotEmpty
(
highlightedSpans
)
Assert
.
Equal
(
1
,
highlightedSpans
.
Length
)
Assert
.
Equal
(
wordMatchSpan
,
highlightedSpans
(
0
))
Next
End
Sub
Private
Sub
TestNotMatches
(
v
As
String
,
wordsToNotMatch
()
As
String
)
Private
Sub
TestNotMatches
(
pattern
As
String
,
wordsToNotMatch
()
As
String
)
Dim
culture
=
New
CultureInfo
(
"tr-TR"
,
useUserOverride
:
=
False
)
Dim
workspace
=
New
TestWorkspace
Dim
helper
=
CompletionHelper
.
GetHelper
(
workspace
,
LanguageNames
.
CSharp
)
For
Each
word
In
wordsToNotMatch
Dim
item
=
CompletionItem
.
Create
(
word
)
Assert
.
False
(
helper
.
MatchesPattern
(
item
.
FilterText
,
v
,
culture
),
$
"Unexpected item {word} matches {v}"
)
Assert
.
False
(
helper
.
MatchesPattern
(
item
.
FilterText
,
pattern
,
culture
),
$
"Unexpected item {word} matches {pattern}"
)
Dim
highlightedSpans
=
helper
.
GetHighlightedSpans
(
item
.
FilterText
,
pattern
,
culture
)
Assert
.
Empty
(
highlightedSpans
)
Next
End
Sub
End
Class
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录