Imported Upstream version 6.0.0.241

Former-commit-id: 6bb91ae3d8008b2e06beaf4212ad32102b270e2a
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2019-05-13 08:34:00 +00:00
parent 2bc8cfd5d0
commit 1efc83b696
61 changed files with 248 additions and 100 deletions

View File

@ -776,5 +776,23 @@ namespace MonoTests.System.Globalization
Assert.IsTrue (f ().Wait (5 * 1000), "#1");
}
[Test]
public void SpanToUpperInvariantDoesntUseCurrentCulture ()
{
string testStr = "test";
var dst = new Span<char> (new char [testStr.Length]);
CultureInfo savedCulture = CultureInfo.CurrentCulture;
CultureInfo.CurrentCulture = new InterceptingLocale ();
testStr.AsSpan ().ToUpperInvariant (dst); // should not throw InvalidOperationException ("Shouldn't be called.")
CultureInfo.CurrentCulture = savedCulture;
Assert.AreEqual ("TEST", dst.ToString ());
}
private class InterceptingLocale : CultureInfo
{
public InterceptingLocale () : base (string.Empty) { }
public override TextInfo TextInfo => throw new InvalidOperationException ("Shouldn't be called.");
}
}
}