提交 330bca57 编写于 作者: J Jared Parsons 提交者: GitHub

Merge pull request #13876 from axel-habermaier/test-bug-invariant-culture

Fix for "Some tests fail due to non-standard cultural settings" (#10362)
......@@ -1297,7 +1297,7 @@ public void AnonymousType_ToString()
{
// test AnonymousType.ToString()
var currCulture = System.Threading.Thread.CurrentThread.CurrentCulture;
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
try
{
var source = @"
......
......@@ -368,7 +368,7 @@ expectedOutput:="VB$AnonymousType_0`1[T0]")
Public Sub TestAnonymousType_ToString()
' test AnonymousType_ToString() itself
Dim currCulture = System.Threading.Thread.CurrentThread.CurrentCulture
System.Threading.Thread.CurrentThread.CurrentCulture = New System.Globalization.CultureInfo("en-US")
System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture
Try
CompileAndVerify(
......@@ -734,7 +734,7 @@ expectedOutput:=<![CDATA[
Public Sub TestAnonymousType_LocalAsNewWith()
' AnonymousType ToString
Dim currCulture = System.Threading.Thread.CurrentThread.CurrentCulture
System.Threading.Thread.CurrentThread.CurrentCulture = New System.Globalization.CultureInfo("en-US")
System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture
Try
CompileAndVerify(
......
......@@ -346,7 +346,7 @@ End Class
' test late bind
' call ToString() on object defeat the purpose
Dim currCulture = Threading.Thread.CurrentThread.CurrentCulture
Threading.Thread.CurrentThread.CurrentCulture = New System.Globalization.CultureInfo("en-US")
Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture
Try
'Declare static local which is late bound
Dim compilationDef = CreateCompilationWithMscorlibAndVBRuntime(
......
......@@ -19,6 +19,11 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.Semantics
<Fact>
Public Sub Test1()
Dim currCulture = System.Threading.Thread.CurrentThread.CurrentCulture
System.Threading.Thread.CurrentThread.CurrentCulture = New System.Globalization.CultureInfo("en-US", useUserOverride:=False)
Try
Dim compilationDef =
<compilation name="VBBinaryOperators1">
<file name="lib.vb">
......@@ -41,6 +46,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.Semantics
CompileAndVerify(compilation, expectedOutput:=My.Resources.Resource.BinaryOperatorsTestBaseline1)
Catch ex As Exception
Assert.Null(ex)
Finally
System.Threading.Thread.CurrentThread.CurrentCulture = currCulture
End Try
End Sub
<Fact>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册