Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
911faded
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,发现更多精彩内容 >>
提交
911faded
编写于
1月 06, 2020
作者:
S
Sam Harwell
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Enable nullable reference types for Microsoft.Build.Tasks.CodeAnalysis.UnitTests
上级
5b295cc6
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
48 addition
and
9 deletion
+48
-9
src/Compilers/Core/MSBuildTaskTests/CscTests.cs
src/Compilers/Core/MSBuildTaskTests/CscTests.cs
+2
-0
src/Compilers/Core/MSBuildTaskTests/CsiTests.cs
src/Compilers/Core/MSBuildTaskTests/CsiTests.cs
+2
-0
src/Compilers/Core/MSBuildTaskTests/DotNetSdkTests.cs
src/Compilers/Core/MSBuildTaskTests/DotNetSdkTests.cs
+2
-0
src/Compilers/Core/MSBuildTaskTests/IntegrationTests.cs
src/Compilers/Core/MSBuildTaskTests/IntegrationTests.cs
+13
-4
src/Compilers/Core/MSBuildTaskTests/MapSourceRootTests.cs
src/Compilers/Core/MSBuildTaskTests/MapSourceRootTests.cs
+7
-0
src/Compilers/Core/MSBuildTaskTests/MiscTests.cs
src/Compilers/Core/MSBuildTaskTests/MiscTests.cs
+2
-0
src/Compilers/Core/MSBuildTaskTests/TestUtilities/DotNetSdkTestBase.cs
.../Core/MSBuildTaskTests/TestUtilities/DotNetSdkTestBase.cs
+8
-5
src/Compilers/Core/MSBuildTaskTests/TestUtilities/DotNetSdkVersionAttribute.cs
...BuildTaskTests/TestUtilities/DotNetSdkVersionAttribute.cs
+3
-0
src/Compilers/Core/MSBuildTaskTests/TestUtilities/EnumerableExtensions.cs
...re/MSBuildTaskTests/TestUtilities/EnumerableExtensions.cs
+3
-0
src/Compilers/Core/MSBuildTaskTests/TestUtilities/MSBuildUtil.cs
...pilers/Core/MSBuildTaskTests/TestUtilities/MSBuildUtil.cs
+2
-0
src/Compilers/Core/MSBuildTaskTests/TestUtilities/MockEngine.cs
...mpilers/Core/MSBuildTaskTests/TestUtilities/MockEngine.cs
+2
-0
src/Compilers/Core/MSBuildTaskTests/VbcTests.cs
src/Compilers/Core/MSBuildTaskTests/VbcTests.cs
+2
-0
未找到文件。
src/Compilers/Core/MSBuildTaskTests/CscTests.cs
浏览文件 @
911faded
...
...
@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#
nullable
enable
using
System
;
using
System.Linq
;
using
Microsoft.Build.Framework
;
...
...
src/Compilers/Core/MSBuildTaskTests/CsiTests.cs
浏览文件 @
911faded
...
...
@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#
nullable
enable
using
System
;
using
Xunit
;
...
...
src/Compilers/Core/MSBuildTaskTests/DotNetSdkTests.cs
浏览文件 @
911faded
...
...
@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#
nullable
enable
using
System.IO
;
using
Roslyn.Test.Utilities
;
...
...
src/Compilers/Core/MSBuildTaskTests/IntegrationTests.cs
浏览文件 @
911faded
...
...
@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#
nullable
enable
using
System
;
using
System.Collections.Generic
;
using
System.Diagnostics
;
...
...
@@ -9,6 +11,7 @@
using
System.Linq
;
using
Microsoft.CodeAnalysis.Test.Utilities
;
using
Roslyn.Test.Utilities
;
using
Roslyn.Utilities
;
using
Xunit
;
namespace
Microsoft.CodeAnalysis.BuildTasks.UnitTests
...
...
@@ -16,7 +19,7 @@ namespace Microsoft.CodeAnalysis.BuildTasks.UnitTests
public
class
IntegrationTests
:
TestBase
{
private
static
readonly
string
s_msbuildDirectory
;
private
static
readonly
string
s_msbuildExecutable
;
private
static
readonly
string
?
s_msbuildExecutable
;
static
IntegrationTests
()
{
...
...
@@ -43,7 +46,7 @@ public IntegrationTests()
_buildTaskDll
=
typeof
(
ManagedCompiler
).
Assembly
.
Location
;
}
private
IEnumerable
<
KeyValuePair
<
string
,
string
>>
AddForLoggingEnvironmentVars
(
IEnumerable
<
KeyValuePair
<
string
,
string
>>
vars
)
private
IEnumerable
<
KeyValuePair
<
string
,
string
>>
AddForLoggingEnvironmentVars
(
IEnumerable
<
KeyValuePair
<
string
,
string
>>
?
vars
)
{
vars
=
vars
??
new
KeyValuePair
<
string
,
string
>[]
{
};
if
(!
vars
.
Where
(
kvp
=>
kvp
.
Key
==
"RoslynCommandLineLogFile"
).
Any
())
...
...
@@ -61,7 +64,7 @@ public IntegrationTests()
string
compilerPath
,
string
arguments
,
string
currentDirectory
,
IEnumerable
<
KeyValuePair
<
string
,
string
>>
additionalEnvironmentVars
=
null
)
IEnumerable
<
KeyValuePair
<
string
,
string
>>
?
additionalEnvironmentVars
=
null
)
{
return
ProcessUtilities
.
Run
(
compilerPath
,
...
...
@@ -75,7 +78,7 @@ public IntegrationTests()
string
arguments
,
TempDirectory
currentDirectory
,
IEnumerable
<
KeyValuePair
<
string
,
string
>>
filesInDirectory
,
IEnumerable
<
KeyValuePair
<
string
,
string
>>
additionalEnvironmentVars
=
null
)
IEnumerable
<
KeyValuePair
<
string
,
string
>>
?
additionalEnvironmentVars
=
null
)
{
foreach
(
var
pair
in
filesInDirectory
)
{
...
...
@@ -406,6 +409,8 @@ End Class
[
Fact
(
Skip
=
"https://github.com/dotnet/roslyn/issues/1445"
)]
public
void
SimpleMSBuild
()
{
RoslynDebug
.
Assert
(
s_msbuildExecutable
is
object
);
string
arguments
=
string
.
Format
(
@"/m /nr:false /t:Rebuild /p:UseSharedCompilation=false /p:UseRoslyn=1 HelloSolution.sln"
);
var
result
=
RunCommandLineCompiler
(
s_msbuildExecutable
,
arguments
,
_tempDirectory
,
SimpleMsBuildFiles
);
...
...
@@ -605,6 +610,8 @@ End Class
[
Fact
(
Skip
=
"https://github.com/dotnet/roslyn/issues/16301"
)]
public
void
ReportAnalyzerMSBuild
()
{
RoslynDebug
.
Assert
(
s_msbuildExecutable
is
object
);
string
arguments
=
string
.
Format
(
@"/m /nr:false /t:Rebuild /p:UseSharedCompilation=false /p:UseRoslyn=1 HelloSolution.sln"
);
var
result
=
RunCommandLineCompiler
(
s_msbuildExecutable
,
arguments
,
_tempDirectory
,
ReportAnalyzerMsBuildFiles
,
new
Dictionary
<
string
,
string
>
...
...
@@ -617,6 +624,8 @@ public void ReportAnalyzerMSBuild()
[
Fact
(
Skip
=
"failing msbuild"
)]
public
void
SolutionWithPunctuation
()
{
RoslynDebug
.
Assert
(
s_msbuildExecutable
is
object
);
var
testDir
=
_tempDirectory
.
CreateDirectory
(
@"SLN;!@(goo)'^1"
);
var
slnFile
=
testDir
.
CreateFile
(
"Console;!@(goo)'^(Application1.sln"
).
WriteAllText
(
@"
...
...
src/Compilers/Core/MSBuildTaskTests/MapSourceRootTests.cs
浏览文件 @
911faded
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#
nullable
enable
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
Microsoft.Build.Framework
;
using
Microsoft.Build.Utilities
;
using
Roslyn.Test.Utilities
;
using
Roslyn.Utilities
;
using
Xunit
;
namespace
Microsoft.CodeAnalysis.BuildTasks.UnitTests
...
...
@@ -52,6 +55,7 @@ public void BasicMapping()
bool
result
=
task
.
Execute
();
AssertEx
.
AssertEqualToleratingWhitespaceDifferences
(
""
,
engine
.
Log
);
RoslynDebug
.
Assert
(
task
.
MappedSourceRoots
is
object
);
Assert
.
Equal
(
4
,
task
.
MappedSourceRoots
.
Length
);
Assert
.
Equal
(
Utilities
.
FixFilePath
(
@"c:\packages\SourcePackage1\"
),
task
.
MappedSourceRoots
[
0
].
ItemSpec
);
...
...
@@ -100,6 +104,7 @@ public void InvalidChars()
bool
result
=
task
.
Execute
();
AssertEx
.
AssertEqualToleratingWhitespaceDifferences
(
""
,
engine
.
Log
);
RoslynDebug
.
Assert
(
task
.
MappedSourceRoots
is
object
);
Assert
.
Equal
(
3
,
task
.
MappedSourceRoots
.
Length
);
Assert
.
Equal
(
Utilities
.
FixFilePath
(
@"!@#:;$%^&*()_+|{}\"
),
task
.
MappedSourceRoots
[
0
].
ItemSpec
);
...
...
@@ -176,6 +181,7 @@ public void NestedRoots_Separators()
bool
result
=
task
.
Execute
();
AssertEx
.
AssertEqualToleratingWhitespaceDifferences
(
""
,
engine
.
Log
);
RoslynDebug
.
Assert
(
task
.
MappedSourceRoots
is
object
);
Assert
.
Equal
(
4
,
task
.
MappedSourceRoots
.
Length
);
Assert
.
Equal
(
Utilities
.
FixFilePath
(
@"c:\MyProjects\MyProject\"
),
task
.
MappedSourceRoots
[
0
].
ItemSpec
);
...
...
@@ -213,6 +219,7 @@ public void SourceRootCaseSensitive()
bool
result
=
task
.
Execute
();
AssertEx
.
AssertEqualToleratingWhitespaceDifferences
(
""
,
engine
.
Log
);
RoslynDebug
.
Assert
(
task
.
MappedSourceRoots
is
object
);
Assert
.
Equal
(
3
,
task
.
MappedSourceRoots
.
Length
);
Assert
.
Equal
(
Utilities
.
FixFilePath
(
@"c:\packages\SourcePackage1\"
),
task
.
MappedSourceRoots
[
0
].
ItemSpec
);
...
...
src/Compilers/Core/MSBuildTaskTests/MiscTests.cs
浏览文件 @
911faded
...
...
@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#
nullable
enable
using
System
;
using
System.Linq
;
using
Microsoft.Build.Framework
;
...
...
src/Compilers/Core/MSBuildTaskTests/TestUtilities/DotNetSdkTestBase.cs
浏览文件 @
911faded
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#
nullable
enable
using
System
;
using
System.Collections.Generic
;
using
System.IO
;
...
...
@@ -21,9 +24,9 @@ public sealed class DotNetSdkAvailable : ExecutionCondition
}
private
static
readonly
string
s_dotnetExeName
;
private
static
readonly
string
s_dotnetInstallDir
;
private
static
readonly
string
?
s_dotnetInstallDir
;
private
static
readonly
string
s_dotnetSdkVersion
;
private
static
readonly
string
s_dotnetSdkPath
;
private
static
readonly
string
?
s_dotnetSdkPath
;
private
static
string
s_projectSource
=
@"<Project Sdk='Microsoft.NET.Sdk'>
...
...
@@ -86,7 +89,7 @@ bool isMatchingDotNetInstance(string dotnetDir)
private
static
void
EmitTestHelperProps
(
string
objDirectory
,
string
projectFileName
,
string
content
)
string
?
content
)
{
// Common.props automatically import {project-name}.*.props files from MSBuildProjectExtensionsPath directory,
// which is by default set to the IntermediateOutputPath:
...
...
@@ -101,7 +104,7 @@ bool isMatchingDotNetInstance(string dotnetDir)
string
outputFile
,
string
projectFileName
,
IEnumerable
<
string
>
expressions
,
string
additionalContent
)
string
?
additionalContent
)
{
// Common.targets automatically import {project-name}.*.targets files from MSBuildProjectExtensionsPath directory,
// which is by defautl set to the IntermediateOutputPath:
...
...
@@ -180,7 +183,7 @@ public DotNetSdkTestBase()
Assert
.
True
(
File
.
Exists
(
Path
.
Combine
(
ObjDir
.
Path
,
ProjectFileName
+
".nuget.g.targets"
)));
}
protected
void
VerifyValues
(
string
customProps
,
string
customTargets
,
string
[]
targets
,
string
[]
expressions
,
string
[]
expectedResults
)
protected
void
VerifyValues
(
string
?
customProps
,
string
?
customTargets
,
string
[]
targets
,
string
[]
expressions
,
string
[]
expectedResults
)
{
var
evaluationResultsFile
=
Path
.
Combine
(
OutDir
.
Path
,
"EvaluationResult.txt"
);
...
...
src/Compilers/Core/MSBuildTaskTests/TestUtilities/DotNetSdkVersionAttribute.cs
浏览文件 @
911faded
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#
nullable
enable
using
System
;
namespace
Microsoft.CodeAnalysis.BuildTasks.UnitTests
...
...
src/Compilers/Core/MSBuildTaskTests/TestUtilities/EnumerableExtensions.cs
浏览文件 @
911faded
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#
nullable
enable
using
System
;
using
System.Collections.Generic
;
...
...
src/Compilers/Core/MSBuildTaskTests/TestUtilities/MSBuildUtil.cs
浏览文件 @
911faded
...
...
@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#
nullable
enable
using
Microsoft.Build.Framework
;
using
Moq
;
using
System
;
...
...
src/Compilers/Core/MSBuildTaskTests/TestUtilities/MockEngine.cs
浏览文件 @
911faded
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#
nullable
enable
using
System
;
using
System.Collections
;
using
System.Text
;
...
...
src/Compilers/Core/MSBuildTaskTests/VbcTests.cs
浏览文件 @
911faded
...
...
@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#
nullable
enable
using
System
;
using
Microsoft.CodeAnalysis.BuildTasks
;
using
Roslyn.Test.Utilities
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录