You've already forked linux-packaging-mono
Imported Upstream version 4.8.0.309
Former-commit-id: 5f9c6ae75f295e057a7d2971f3a6df4656fa8850
This commit is contained in:
parent
ee1447783b
commit
94b2861243
@@ -23,8 +23,12 @@ namespace MonoTests.System
|
||||
|
||||
private bool RunningOnWindows {
|
||||
get {
|
||||
int os = (int)Environment.OSVersion.Platform;
|
||||
return (os != 4);
|
||||
return Path.DirectorySeparatorChar == '\\';
|
||||
}
|
||||
}
|
||||
private bool RunningOnMono {
|
||||
get {
|
||||
return (Type.GetType ("System.MonoType", false) != null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,22 +76,18 @@ namespace MonoTests.System
|
||||
[Test]
|
||||
public void ApplicationBase1 ()
|
||||
{
|
||||
string expected_path = tmpPath.Replace(@"\", @"/");
|
||||
string expected_path = tmpPath;
|
||||
AppDomainSetup setup = new AppDomainSetup ();
|
||||
string fileUri = "file://" + expected_path;
|
||||
string fileUri = "file://" + tmpPath.Replace(@"\", @"/");
|
||||
setup.ApplicationBase = fileUri;
|
||||
// with MS 1.1 SP1 the expected_path starts with "//" but this make
|
||||
// sense only under Windows (i.e. reversed \\ for local files)
|
||||
if (RunningOnWindows)
|
||||
expected_path = "//" + expected_path;
|
||||
try {
|
||||
// under 2.0 the NotSupportedException is throw when getting
|
||||
// under .NET the NotSupportedException is throw when getting
|
||||
// (and not setting) the ApplicationBase property
|
||||
Assert.AreEqual (expected_path, setup.ApplicationBase);
|
||||
}
|
||||
catch (NotSupportedException) {
|
||||
// however the path is invalid only on Windows
|
||||
if (!RunningOnWindows)
|
||||
// however the path is invalid only on .NET
|
||||
if (RunningOnMono)
|
||||
throw;
|
||||
}
|
||||
}
|
||||
@@ -114,16 +114,17 @@ namespace MonoTests.System
|
||||
{
|
||||
AppDomainSetup setup = new AppDomainSetup ();
|
||||
setup.ApplicationBase = "lala:la";
|
||||
try {
|
||||
// under 2.0 the NotSupportedException is throw when getting
|
||||
// (and not setting) the ApplicationBase property
|
||||
if (!RunningOnWindows) {
|
||||
Assert.AreEqual (Path.GetFullPath ("lala:la"), setup.ApplicationBase);
|
||||
}
|
||||
catch (NotSupportedException) {
|
||||
// however the path is invalid only on Windows
|
||||
// (same exceptions as Path.GetFullPath)
|
||||
if (!RunningOnWindows)
|
||||
throw;
|
||||
} else {
|
||||
// On Windows we expect a NotSupportedException to be thrown because
|
||||
// of the illegal character (:) in the path
|
||||
try {
|
||||
Assert.Fail ("NotSupportedException expected but setup.ApplicationBase returned:" + setup.ApplicationBase);
|
||||
}
|
||||
catch (NotSupportedException) {
|
||||
// Expected
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,16 +134,18 @@ namespace MonoTests.System
|
||||
// This is failing because of (probably) a windows-ism, so don't worry
|
||||
AppDomainSetup setup = new AppDomainSetup ();
|
||||
setup.ApplicationBase = "file:///lala:la";
|
||||
try {
|
||||
// under 2.0 the NotSupportedException is throw when getting
|
||||
// (and not setting) the ApplicationBase property
|
||||
Assert.AreEqual ("/lala:la", setup.ApplicationBase);
|
||||
}
|
||||
catch (NotSupportedException) {
|
||||
// however the path is invalid only on Windows
|
||||
// (same exceptions as Path.GetFullPath)
|
||||
if (!RunningOnWindows)
|
||||
throw;
|
||||
string expected = "/lala:la";
|
||||
if (!RunningOnWindows) {
|
||||
Assert.AreEqual (expected, setup.ApplicationBase);
|
||||
} else {
|
||||
// On Windows we expect a NotSupportedException to be thrown because
|
||||
// of the illegal character (:) in the path
|
||||
try {
|
||||
Assert.Fail ("NotSupportedException expected but setup.ApplicationBase returned:" + setup.ApplicationBase);
|
||||
}
|
||||
catch (NotSupportedException) {
|
||||
// Expected
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,19 +156,45 @@ namespace MonoTests.System
|
||||
setup.ApplicationBase = "la?lala";
|
||||
// paths containing "?" are *always* bad on Windows
|
||||
// but are legal for linux so we return a full path
|
||||
if (RunningOnWindows) {
|
||||
if (!RunningOnWindows) {
|
||||
Assert.AreEqual (Path.GetFullPath ("la?lala"), setup.ApplicationBase);
|
||||
} else {
|
||||
// On Windows we expect a ArgumentException to be thrown because
|
||||
// of the illegal character (?) in the path
|
||||
try {
|
||||
// ArgumentException is throw when getting
|
||||
// (and not setting) the ApplicationBase property
|
||||
Assert.Fail ("setup.ApplicationBase returned :" + setup.ApplicationBase);
|
||||
Assert.Fail ("ArgumentException expected but setup.ApplicationBase returned:" + setup.ApplicationBase);
|
||||
}
|
||||
catch (ArgumentException) {
|
||||
// Expected
|
||||
}
|
||||
catch (Exception e) {
|
||||
Assert.Fail ("Unexpected exception: " + e.ToString ());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ApplicationBase7 ()
|
||||
{
|
||||
if (RunningOnWindows) {
|
||||
// Extended paths are Windows only
|
||||
AppDomainSetup setup = new AppDomainSetup ();
|
||||
string expected = @"\\?\" + curDir;
|
||||
setup.ApplicationBase = expected;
|
||||
Assert.AreEqual (expected, setup.ApplicationBase);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ApplicationBase8 ()
|
||||
{
|
||||
if (RunningOnWindows) {
|
||||
// Extended paths are Windows only
|
||||
AppDomainSetup setup = new AppDomainSetup ();
|
||||
setup.ApplicationBase = @"\\?\C:\lala:la";
|
||||
try {
|
||||
Assert.Fail ("NotSupportedException expected but setup.ApplicationBase returned:" + setup.ApplicationBase);
|
||||
}
|
||||
catch (NotSupportedException) {
|
||||
// Expected
|
||||
}
|
||||
} else {
|
||||
Assert.AreEqual (Path.GetFullPath ("la?lala"), setup.ApplicationBase);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
03de187af3d953521b3b78452e6eff523b6be07a
|
||||
34874b1f81f0bae8977486ef067eec0eceac7e71
|
||||
@@ -156,7 +156,6 @@ namespace MonoTests.System
|
||||
Assert.AreEqual (myArrSeg_1 != myArrSeg_2, true);
|
||||
}
|
||||
|
||||
#if NET_4_5
|
||||
[Test]
|
||||
public void IList_NotSupported ()
|
||||
{
|
||||
@@ -278,6 +277,5 @@ namespace MonoTests.System
|
||||
IList<byte> seg = new ArraySegment<byte> (arr);
|
||||
seg[4] = 3;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -903,7 +903,13 @@ namespace MonoTests.System
|
||||
Assert.AreEqual (1, res.Length, "#1");
|
||||
}
|
||||
|
||||
abstract class Abs
|
||||
abstract class Root
|
||||
{
|
||||
[MyAttribute]
|
||||
public abstract void Foo ();
|
||||
}
|
||||
|
||||
abstract class Abs : Root
|
||||
{
|
||||
public abstract string Name { get; set; }
|
||||
}
|
||||
@@ -915,6 +921,8 @@ namespace MonoTests.System
|
||||
get { return ""; }
|
||||
set {}
|
||||
}
|
||||
|
||||
public override void Foo () { }
|
||||
}
|
||||
|
||||
class Sub: Base
|
||||
@@ -1032,6 +1040,27 @@ namespace MonoTests.System
|
||||
a.GetHashCode ();
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void DerivedClassOverrideHasInhertedAttributeFromAbstractRoot ()
|
||||
{
|
||||
// regression test for #44010
|
||||
// we have
|
||||
// abstract class Root {
|
||||
// [MyAttribute]
|
||||
// public abstract void Foo ();
|
||||
// }
|
||||
// abstract class Abs : Root { }
|
||||
// class Base : Abs {
|
||||
// public override void Foo () { }
|
||||
// }
|
||||
// note that Abs does not itself override Foo.
|
||||
var bt = typeof(Base);
|
||||
var m = bt.GetMethod ("Foo");
|
||||
var attribute = Attribute.GetCustomAttribute (m, typeof (MyAttribute), true);
|
||||
Assert.IsNotNull (attribute);
|
||||
}
|
||||
|
||||
class ArrayAttribute : Attribute
|
||||
{
|
||||
#pragma warning disable 414
|
||||
|
||||
@@ -790,7 +790,7 @@ namespace MonoTests.System
|
||||
Assert.IsNull (ex.InnerException, "#C3");
|
||||
Assert.IsNotNull (ex.Message, "#C4");
|
||||
Assert.IsNotNull (ex.ParamName, "#C5");
|
||||
Assert.AreEqual ("byteArray", ex.ParamName, "#C6");
|
||||
Assert.AreEqual ("value", ex.ParamName, "#C6");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -332,7 +332,6 @@ public class ConsoleTest
|
||||
|
||||
#if !MOBILE
|
||||
|
||||
#if NET_4_5
|
||||
[Test]
|
||||
public void RedirectedTest ()
|
||||
{
|
||||
@@ -343,7 +342,6 @@ public class ConsoleTest
|
||||
Console.SetError (TextWriter.Null);
|
||||
Assert.IsFalse (Console.IsErrorRedirected);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Bug 678357
|
||||
[Test]
|
||||
|
||||
@@ -1 +1 @@
|
||||
2124aa85733b05943c15d6c00f8c006ed856713e
|
||||
2391dbb65071a4f0a313703b9e3aac16d322de59
|
||||
@@ -1251,7 +1251,7 @@ namespace MonoTests.System
|
||||
}
|
||||
}
|
||||
|
||||
delegate int IntNoArgs ();
|
||||
public delegate int IntNoArgs ();
|
||||
|
||||
[Test]
|
||||
public void CreateDelegateWithAbstractMethods ()
|
||||
@@ -1445,6 +1445,18 @@ namespace MonoTests.System
|
||||
var del = Delegate.Remove (del1, del2);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentException))]
|
||||
public void CreateDelegateThrowsAnArgumentExceptionWhenCalledWithAnOpenGeneric()
|
||||
{
|
||||
var m = GetType().GetMethod("AnyGenericMethod");
|
||||
Delegate.CreateDelegate(typeof(Action), this, m);
|
||||
}
|
||||
|
||||
public void AnyGenericMethod<T>()
|
||||
{
|
||||
}
|
||||
|
||||
static bool Int32D2 (int x, int y)
|
||||
{
|
||||
return (x & y) == y;
|
||||
|
||||
@@ -147,6 +147,7 @@ namespace MonoTests.System
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Culture ("en-US")]
|
||||
public void Parse ()
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
@@ -138,7 +138,7 @@ namespace MonoTests.System
|
||||
Assert.IsFalse (d.IsSynchronized, "IsSynchronized");
|
||||
}
|
||||
|
||||
#if !NET_2_1
|
||||
#if !MOBILE
|
||||
[Test] // bug #333740
|
||||
public void GetEnvironmentVariables_NewlySet ()
|
||||
{
|
||||
@@ -165,7 +165,7 @@ namespace MonoTests.System
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !NET_2_1
|
||||
#if !MOBILE
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentException))]
|
||||
public void GetEnvironmentVariable_Target_Invalid ()
|
||||
|
||||
72
mcs/class/corlib/Test/System/GCTest.cs
Normal file
72
mcs/class/corlib/Test/System/GCTest.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
//
|
||||
// GCTest.cs - NUnit Test Cases for GC
|
||||
//
|
||||
// Authors:
|
||||
// Marek Safar <marek.safar@gmail.com>
|
||||
//
|
||||
// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTests.System {
|
||||
|
||||
[TestFixture]
|
||||
public class GCTest {
|
||||
|
||||
class MyFinalizeObject
|
||||
{
|
||||
public volatile static int finalized;
|
||||
|
||||
~MyFinalizeObject ()
|
||||
{
|
||||
if (finalized++ == 0) {
|
||||
GC.ReRegisterForFinalize (this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void Run_ReRegisterForFinalizeTest ()
|
||||
{
|
||||
var m = new WeakReference<MyFinalizeObject> (new MyFinalizeObject ());
|
||||
m.SetTarget (null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ReRegisterForFinalizeTest ()
|
||||
{
|
||||
Run_ReRegisterForFinalizeTest ();
|
||||
var t = Task.Factory.StartNew (() => {
|
||||
do {
|
||||
GC.Collect ();
|
||||
GC.WaitForPendingFinalizers ();
|
||||
Task.Yield ();
|
||||
} while (MyFinalizeObject.finalized != 2);
|
||||
});
|
||||
|
||||
Assert.IsTrue (t.Wait (5000));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -359,6 +359,21 @@ namespace MonoTests.System
|
||||
Assert.IsFalse (tzi.IsDaylightSavingTime (date));
|
||||
Assert.AreEqual (new TimeSpan (2,0,0), tzi.GetUtcOffset (date));
|
||||
}
|
||||
|
||||
[Test] //Covers #41349
|
||||
public void TestIsDST_DateTimeOffset ()
|
||||
{
|
||||
TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById ("Europe/Athens");
|
||||
var date = new DateTime (2014, 3, 30 , 2, 0, 0);
|
||||
var offset = tzi.GetUtcOffset (date);
|
||||
var dateOffset = new DateTimeOffset (date, offset);
|
||||
Assert.IsFalse (tzi.IsDaylightSavingTime (dateOffset));
|
||||
|
||||
date = new DateTime (2014, 3, 30 , 3, 0, 0);
|
||||
offset = tzi.GetUtcOffset (date);
|
||||
dateOffset = new DateTimeOffset (date, offset);
|
||||
Assert.IsTrue (tzi.IsDaylightSavingTime (dateOffset));
|
||||
}
|
||||
}
|
||||
|
||||
[TestFixture]
|
||||
|
||||
@@ -1 +1 @@
|
||||
1e38f069af2b809045fa4e4cb2b686d035553a3f
|
||||
d9eea5672d519baa2abbb431cd364b9620888b26
|
||||
@@ -124,7 +124,6 @@ namespace MonoTests.System {
|
||||
Assert.IsFalse (Foo.failed);
|
||||
}
|
||||
|
||||
#if NET_4_5
|
||||
[Test]
|
||||
public void WeakReferenceT_TryGetTarget_NullTarget ()
|
||||
{
|
||||
@@ -132,7 +131,6 @@ namespace MonoTests.System {
|
||||
object obj;
|
||||
Assert.IsFalse (r.TryGetTarget (out obj), "#1");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user