diff options
author | Bernhard Urban <bernhard.urban@xamarin.com> | 2017-11-16 19:04:18 +0300 |
---|---|---|
committer | Bernhard Urban <bernhard.urban@xamarin.com> | 2017-11-16 19:11:42 +0300 |
commit | ae9cef910378a619cbc68433ae4a05c96f605f22 (patch) | |
tree | d8e42fab9f7120304195607c9670f588256efb85 /mcs | |
parent | 3318b2970462b01369daec5bb22b0fe4b3f89866 (diff) |
[corlib] fix DefaultThreadCurrentCultureIsIgnoredWhenCultureFlowsToThread test
this test case was broken for an unknown time, but surfaced with a
recent change in nunit-lite (2255c54966b541095a93be16627e92acebf87215)
that runs every test in a new `ExecutionContext`. Previously, the
pre-condition for this test was implicility fulfilled by another test.
The test failed already when executed only on its own. With the change
around `ExecutionContext`, each test is "isolated" regarding said
pre-condition.
The fix is to explicitly fulfil the pre-condition in the test.
Diffstat (limited to 'mcs')
-rw-r--r-- | mcs/class/corlib/Test/System.Globalization/CultureInfoTest.cs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/mcs/class/corlib/Test/System.Globalization/CultureInfoTest.cs b/mcs/class/corlib/Test/System.Globalization/CultureInfoTest.cs index 766065b67be..188fc33b5e8 100644 --- a/mcs/class/corlib/Test/System.Globalization/CultureInfoTest.cs +++ b/mcs/class/corlib/Test/System.Globalization/CultureInfoTest.cs @@ -730,6 +730,14 @@ namespace MonoTests.System.Globalization string us_str = null; string br_str = null; + /* explicitly set CurrentCulture, as the documentation states: + * > If you have not explicitly set the culture of any existing + * > threads executing in an application domain, setting the + * > P:System.Globalization.CultureInfo.DefaultThreadCurrentCulture + * > property also changes the culture of these threads. + */ + Thread.CurrentThread.CurrentCulture = old_culture; + var thread = new Thread (() => { CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US"); us_str = 100000.ToString ("C"); |