提交 42fe0347 编写于 作者: T Tomas Matousek

Fix or skip tests to work on Unix

上级 05d35745
......@@ -326,7 +326,7 @@ public void Args_Interactive2()
AssertEx.AssertEqualToleratingWhitespaceDifferences(error, runner.Console.Error.ToString());
}
[Fact]
[ConditionalFact(typeof(WindowsOnly)), WorkItem(15860, "https://github.com/dotnet/roslyn/issues/15860")]
public void Args_InteractiveWithScript1()
{
var script = Temp.CreateFile(extension: ".csx").WriteAllText("foreach (var arg in Args) Print(arg);");
......@@ -359,7 +359,7 @@ > 1
> ", runner.Console.Out.ToString());
}
[Fact]
[ConditionalFact(typeof(WindowsOnly)), WorkItem(15860, "https://github.com/dotnet/roslyn/issues/15860")]
public void Args_Script1()
{
var script = Temp.CreateFile(extension: ".csx").WriteAllText("foreach (var arg in Args) Print(arg);");
......@@ -367,7 +367,7 @@ public void Args_Script1()
var runner = CreateRunner(
args: new[] { script.Path, "arg1", "arg2", "arg3" });
Assert.Equal(0, runner.RunInteractive());
Assert.True(runner.RunInteractive() == 0, userMessage: runner.Console.Error.ToString());
AssertEx.AssertEqualToleratingWhitespaceDifferences($@"
""arg1""
......@@ -376,7 +376,7 @@ public void Args_Script1()
", runner.Console.Out.ToString());
}
[Fact]
[ConditionalFact(typeof(WindowsOnly)), WorkItem(15860, "https://github.com/dotnet/roslyn/issues/15860")]
public void Args_Script2()
{
var script = Temp.CreateFile(extension: ".csx").WriteAllText("foreach (var arg in Args) Print(arg);");
......@@ -384,7 +384,7 @@ public void Args_Script2()
var runner = CreateRunner(
args: new[] { script.Path, "@arg1", "@arg2", "@arg3" });
Assert.Equal(0, runner.RunInteractive());
Assert.True(runner.RunInteractive() == 0, userMessage: runner.Console.Error.ToString());
AssertEx.AssertEqualToleratingWhitespaceDifferences($@"
""@arg1""
......@@ -393,7 +393,7 @@ public void Args_Script2()
", runner.Console.Out.ToString());
}
[Fact]
[ConditionalFact(typeof(WindowsOnly)), WorkItem(15860, "https://github.com/dotnet/roslyn/issues/15860")]
public void Args_Script3()
{
var script = Temp.CreateFile(extension: ".csx").WriteAllText("foreach (var arg in Args) Print(arg);");
......@@ -412,7 +412,7 @@ public void Args_Script3()
args: new[] { $"@{rsp.Path}", "/arg5", "--", "/arg7" },
input: "foreach (var arg in Args) Print(arg);");
Assert.Equal(0, runner.RunInteractive());
Assert.True(runner.RunInteractive() == 0, userMessage: runner.Console.Error.ToString());
AssertEx.AssertEqualToleratingWhitespaceDifferences($@"
""--""
......
......@@ -1167,13 +1167,13 @@ public void ReferenceDirective_RelativeToBaseParent()
string scriptPath = Path.Combine(dir, "a.csx");
var script = CSharpScript.Create(
$@"#r ""..\{libFileName}""",
$@"#r ""{Path.Combine("..", libFileName)}""",
ScriptOptions.Default.WithFilePath(scriptPath));
script.GetCompilation().VerifyDiagnostics();
}
[Fact]
[ConditionalFact(typeof(WindowsOnly)), WorkItem(15860, "https://github.com/dotnet/roslyn/issues/15860")]
public void ReferenceDirective_RelativeToBaseRoot()
{
var file = Temp.CreateFile();
......
......@@ -342,7 +342,7 @@ public void LongMembers()
Assert.Equal("LongMembers { LongNa...", str);
str = new TestCSharpObjectFormatter(maximumLineLength: 20).FormatObject(obj, SeparateLinesOptions);
Assert.Equal("LongMembers {\r\n LongName0123456789...\r\n LongValue: \"012345...\r\n}\r\n", str);
Assert.Equal($"LongMembers {{{Environment.NewLine} LongName0123456789...{Environment.NewLine} LongValue: \"012345...{Environment.NewLine}}}{Environment.NewLine}", str);
}
[Fact]
......@@ -834,7 +834,7 @@ public static void Method<U>()
}
}
[Fact]
[ConditionalFact(typeof(WindowsOnly)), WorkItem(15860, "https://github.com/dotnet/roslyn/issues/15860")]
public void StackTrace_NonGeneric()
{
try
......@@ -855,7 +855,7 @@ public void StackTrace_NonGeneric()
}
}
[Fact]
[ConditionalFact(typeof(WindowsOnly)), WorkItem(15860, "https://github.com/dotnet/roslyn/issues/15860")]
public void StackTrace_GenericMethod()
{
try
......@@ -877,7 +877,7 @@ public void StackTrace_GenericMethod()
}
}
[Fact]
[ConditionalFact(typeof(WindowsOnly)), WorkItem(15860, "https://github.com/dotnet/roslyn/issues/15860")]
public void StackTrace_GenericType()
{
try
......@@ -899,7 +899,7 @@ public void StackTrace_GenericType()
}
}
[Fact]
[ConditionalFact(typeof(WindowsOnly)), WorkItem(15860, "https://github.com/dotnet/roslyn/issues/15860")]
public void StackTrace_GenericMethodInGenericType()
{
try
......@@ -968,7 +968,7 @@ public static void Method<U>(ref U u)
}
}
[Fact]
[ConditionalFact(typeof(WindowsOnly)), WorkItem(15860, "https://github.com/dotnet/roslyn/issues/15860")]
public void StackTrace_RefOutParameters()
{
try
......@@ -991,7 +991,7 @@ public void StackTrace_RefOutParameters()
}
}
[Fact]
[ConditionalFact(typeof(WindowsOnly)), WorkItem(15860, "https://github.com/dotnet/roslyn/issues/15860")]
public void StackTrace_GenericRefParameter()
{
try
......
......@@ -181,7 +181,7 @@ private PortableExecutableReference ResolveTrustedPlatformAssemblyCore(string na
{
var set = ImmutableDictionary.CreateBuilder<string, string>(StringComparer.OrdinalIgnoreCase);
if (CoreClrShim.AppContext.GetData("TRUSTED_PLATFORM_ASSEMBLIES") is string paths)
if (CoreClrShim.AppContext.GetData?.Invoke("TRUSTED_PLATFORM_ASSEMBLIES") is string paths)
{
foreach (var path in paths.Split(Path.PathSeparator))
{
......
......@@ -15,7 +15,7 @@ public abstract class ObjectFormatterTestBase
public void AssertMembers(string str, params string[] expected)
{
int i = 0;
foreach (var line in str.Split(new[] { "\r\n " }, StringSplitOptions.None))
foreach (var line in str.Split(new[] { Environment.NewLine + " " }, StringSplitOptions.None))
{
if (i == 0)
{
......@@ -23,7 +23,7 @@ public void AssertMembers(string str, params string[] expected)
}
else if (i == expected.Length - 1)
{
Assert.Equal(expected[i] + "\r\n}\r\n", line);
Assert.Equal(expected[i] + Environment.NewLine + "}" + Environment.NewLine, line);
}
else
{
......
......@@ -11,7 +11,9 @@
using Microsoft.CodeAnalysis.CodeGen;
using Microsoft.CodeAnalysis.Emit;
using Microsoft.CodeAnalysis.Test.Extensions;
using Roslyn.Test.PdbUtilities;
using Roslyn.Test.Utilities;
using Roslyn.Utilities;
using Xunit;
using Xunit.Sdk;
......@@ -33,7 +35,7 @@ public static class CompilationExtensions
if (pdbStream == null && compilation.Options.OptimizationLevel == OptimizationLevel.Debug && options?.DebugInformationFormat != DebugInformationFormat.Embedded)
{
if (MonoHelpers.IsRunningOnMono())
if (MonoHelpers.IsRunningOnMono() || PathUtilities.IsUnixLikePlatform)
{
options = (options ?? EmitOptions.Default).WithDebugInformationFormat(DebugInformationFormat.PortablePdb);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册