Skip to content

Commit

Permalink
Merge pull request dotnet#24407 from MaStr11/FixLocalizationTestFailu…
Browse files Browse the repository at this point in the history
…res1

Localization test failures 1
  • Loading branch information
sharwell committed Feb 14, 2018
2 parents 97e15b3 + 7dcf050 commit 6bfea1a
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 173 deletions.
1 change: 1 addition & 0 deletions src/Compilers/CSharp/Portable/CSharpCodeAnalysis.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
<InternalsVisibleToTest Include="Microsoft.CodeAnalysis.Scripting.Destkop.UnitTests" />
<InternalsVisibleToTest Include="Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests" />
<InternalsVisibleToTest Include="Microsoft.CodeAnalysis.CSharp.Scripting.Desktop.UnitTests" />
<InternalsVisibleToTest Include="Roslyn.InteractiveHost.UnitTests" />
<InternalsVisibleToTest Include="Roslyn.Services.Editor.UnitTests" />
<InternalsVisibleToTest Include="Roslyn.Services.Editor.CSharp.UnitTests" />
<InternalsVisibleToTest Include="Roslyn.Services.Editor2.UnitTests" />
Expand Down
17 changes: 9 additions & 8 deletions src/Interactive/HostTest/InteractiveHostTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Test.Utilities;
using Microsoft.CodeAnalysis.Editor.CSharp;
using Microsoft.CodeAnalysis.Editor.CSharp.Interactive;
using Microsoft.CodeAnalysis.Interactive;
using Microsoft.CodeAnalysis.Test.Utilities;
Expand Down Expand Up @@ -57,7 +58,7 @@ public InteractiveHostTests()

Assert.Equal("", errorOutput);
Assert.Equal(2, output.Length);
Assert.Equal("Microsoft (R) Roslyn C# Compiler version " + FileVersionInfo.GetVersionInfo(_host.GetType().Assembly.Location).FileVersion, output[0]);
Assert.Equal(string.Format(CSharpInteractiveEditorResources.Microsoft_R_Roslyn_CSharp_Compiler_version_0, FileVersionInfo.GetVersionInfo(_host.GetType().Assembly.Location).FileVersion), output[0]);
// "Type "#help" for more information."
Assert.Equal(FeaturesResources.Type_Sharphelp_for_more_information, output[1]);

Expand Down Expand Up @@ -853,7 +854,7 @@ public void ReferencePaths()

var output = SplitLines(ReadOutputToEnd());
Assert.Equal(2, output.Length);
Assert.Equal("Loading context from '" + Path.GetFileName(rspFile.Path) + "'.", output[0]);
Assert.Equal($"{ string.Format(FeaturesResources.Loading_context_from_0, Path.GetFileName(rspFile.Path)) }", output[0]);
Assert.Equal($"[{assemblyName}, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]", output[1]);
}

Expand Down Expand Up @@ -906,7 +907,7 @@ public void DefaultUsings()
AssertEx.AssertEqualToleratingWhitespaceDifferences("", ReadErrorOutputToEnd());

AssertEx.AssertEqualToleratingWhitespaceDifferences(
$@"Loading context from '{Path.GetFileName(rspFile.Path)}'.
$@"{ string.Format(FeaturesResources.Loading_context_from_0, Path.GetFileName(rspFile.Path)) }
OK
", ReadOutputToEnd());
}
Expand All @@ -929,11 +930,11 @@ public void InitialScript_Error()
Execute("new Process()");

AssertEx.AssertEqualToleratingWhitespaceDifferences($@"
{initFile.Path}(1,3): error CS1002: ; expected
{initFile.Path}(1,3): error CS1002: { CSharpResources.ERR_SemicolonExpected }
", ReadErrorOutputToEnd());

AssertEx.AssertEqualToleratingWhitespaceDifferences($@"
Loading context from '{Path.GetFileName(rspFile.Path)}'.
{ string.Format(FeaturesResources.Loading_context_from_0, Path.GetFileName(rspFile.Path)) }
[System.Diagnostics.Process]
", ReadOutputToEnd());
}
Expand All @@ -955,7 +956,7 @@ public void ScriptAndArguments()
Assert.Equal("", ReadErrorOutputToEnd());

AssertEx.AssertEqualToleratingWhitespaceDifferences(
$@"Loading context from '{Path.GetFileName(rspFile.Path)}'.
$@"{ string.Format(FeaturesResources.Loading_context_from_0, Path.GetFileName(rspFile.Path)) }
""a""
""b""
""c""
Expand Down Expand Up @@ -986,8 +987,8 @@ public void Script_NoHostNamespaces()
{
Execute("nameof(Microsoft.CodeAnalysis)");

AssertEx.AssertEqualToleratingWhitespaceDifferences(@"
(1,8): error CS0234: The type or namespace name 'CodeAnalysis' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)",
AssertEx.AssertEqualToleratingWhitespaceDifferences($@"
(1,8): error CS0234: { string.Format(CSharpResources.ERR_DottedTypeNameNotFoundInNS, "CodeAnalysis", "Microsoft") }",
ReadErrorOutputToEnd());

Assert.Equal("", ReadOutputToEnd());
Expand Down
22 changes: 14 additions & 8 deletions src/Scripting/CSharpTest.Desktop/CsiTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System;
using System.IO;
using System.Reflection;
using Microsoft.CodeAnalysis.Scripting;
using Roslyn.Test.Utilities;
using Roslyn.Utilities;
using Xunit;
Expand Down Expand Up @@ -50,19 +51,24 @@ public void CurrentWorkingDirectory_Change()
Environment.Exit(0)
");

AssertEx.AssertEqualToleratingWhitespaceDifferences($@"
Microsoft (R) Visual C# Interactive Compiler version {s_compilerVersion}
Copyright (C) Microsoft Corporation. All rights reserved.
var expected = $@"
{ string.Format(CSharpScriptingResources.LogoLine1, s_compilerVersion) }
{CSharpScriptingResources.LogoLine2}
Type ""#help"" for more information.
{ScriptingResources.HelpPrompt}
> > > > > > 1
> C {{ }}
>
", result.Output);
";
// The German translation (and possibly others) contains an en dash (0x2013),
// but csi.exe outputs it as a hyphen-minus (0x002d). We need to fix up the
// expected string before we can compare it to the actual output.
expected = expected.Replace((char)0x2013, (char)0x002d); // EN DASH -> HYPHEN-MINUS
AssertEx.AssertEqualToleratingWhitespaceDifferences(expected, result.Output);

AssertEx.AssertEqualToleratingWhitespaceDifferences($@"
(1,7): error CS1504: Source file 'a.csx' could not be opened -- Could not find file.
(1,1): error CS0006: Metadata file 'C.dll' could not be found
(1,7): error CS1504: { string.Format(CSharpResources.ERR_NoSourceFile, "a.csx", CSharpResources.CouldNotFindFile) }
(1,1): error CS0006: { string.Format(CSharpResources.ERR_NoMetadataFile,"C.dll") }
", result.Errors);

Assert.Equal(0, result.ExitCode);
Expand Down Expand Up @@ -143,7 +149,7 @@ public void LineNumber_Information_On_Exception()
AssertEx.AssertEqualToleratingWhitespaceDifferences("OK", result.Output);
AssertEx.AssertEqualToleratingWhitespaceDifferences($@"
Error!
+ <Initialize>.MoveNext() at {cwd}{Path.DirectorySeparatorChar}a.csx : 2
+ <Initialize>.MoveNext(){string.Format(ScriptingResources.AtFileLine, $"{cwd}{Path.DirectorySeparatorChar}a.csx", "2")}
", result.Errors);
}
}
Expand Down
Loading

0 comments on commit 6bfea1a

Please sign in to comment.