Imported Upstream version 5.10.0.47

Former-commit-id: d0813289fa2d35e1f8ed77530acb4fb1df441bc0
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-01-24 17:04:36 +00:00
parent 88ff76fe28
commit e46a49ecf1
5927 changed files with 226314 additions and 129848 deletions

View File

@@ -207,12 +207,6 @@ namespace MonoTests.System.Diagnostics
Assert.AreEqual (2, ex.NativeErrorCode, "#B6");
}
if (RunningOnUnix)
Assert.Ignore ("On Unix and Mac OS X, we try " +
"to open any file (using xdg-open, ...)" +
" and we do not report an exception " +
"if this fails.");
// absolute path, shell
process.StartInfo.FileName = exe;
process.StartInfo.UseShellExecute = true;

View File

@@ -46,6 +46,7 @@ namespace MonoTests.System.IO.Compression
[Test]
[ExpectedException (typeof (ArgumentNullException))]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void Constructor_Null ()
{
DeflateStream ds = new DeflateStream (null, CompressionMode.Compress);
@@ -53,12 +54,14 @@ namespace MonoTests.System.IO.Compression
[Test]
[ExpectedException (typeof (ArgumentException))]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void Constructor_InvalidCompressionMode ()
{
DeflateStream ds = new DeflateStream (new MemoryStream (), (CompressionMode)Int32.MinValue);
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void CheckCompressDecompress ()
{
byte [] data = new byte[100000];
@@ -81,6 +84,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void CheckDecompress ()
{
MemoryStream backing = new MemoryStream (compressed_data);
@@ -92,6 +96,7 @@ namespace MonoTests.System.IO.Compression
// https://bugzilla.xamarin.com/show_bug.cgi?id=22346
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void CheckEmptyRead ()
{
byte [] dummy = new byte[1];
@@ -102,6 +107,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (ArgumentNullException))]
public void CheckNullRead ()
{
@@ -111,6 +117,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (InvalidOperationException))]
public void CheckCompressingRead ()
{
@@ -121,6 +128,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (ArgumentException))]
public void CheckRangeRead ()
{
@@ -132,6 +140,7 @@ namespace MonoTests.System.IO.Compression
#if !MOBILE
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[Category("NotWorking")]
[ExpectedException (typeof (InvalidDataException))]
public void CheckInvalidDataRead ()
@@ -145,6 +154,7 @@ namespace MonoTests.System.IO.Compression
#endif
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (ObjectDisposedException))]
public void CheckClosedRead ()
{
@@ -156,6 +166,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (ObjectDisposedException))]
public void CheckClosedFlush ()
{
@@ -166,6 +177,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (NotSupportedException))]
public void CheckSeek ()
{
@@ -175,6 +187,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (NotSupportedException))]
public void CheckSetLength ()
{
@@ -184,6 +197,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void CheckGetCanSeekProp ()
{
MemoryStream backing = new MemoryStream (compressed_data);
@@ -204,6 +218,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void CheckGetCanReadProp ()
{
MemoryStream backing = new MemoryStream (compressed_data);
@@ -224,6 +239,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void CheckGetCanWriteProp ()
{
MemoryStream backing = new MemoryStream ();
@@ -244,6 +260,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (NotSupportedException))]
public void CheckSetLengthProp ()
{
@@ -253,6 +270,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (NotSupportedException))]
public void CheckGetLengthProp ()
{
@@ -262,6 +280,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (NotSupportedException))]
public void CheckGetPositionProp ()
{
@@ -271,6 +290,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void DisposeTest ()
{
MemoryStream backing = new MemoryStream (compressed_data);
@@ -284,6 +304,7 @@ namespace MonoTests.System.IO.Compression
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void JunkAtTheEnd ()
{
// Write a deflated stream, then some additional data...
@@ -330,6 +351,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void Bug19313 ()
{
byte [] buffer = new byte [512];
@@ -344,6 +366,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void CheckNet45Overloads () // Xambug #21982
{
MemoryStream dataStream = GenerateStreamFromString("Hello");
@@ -362,6 +385,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (ArgumentException))]
public void CheckBufferOverrun ()
{
@@ -374,6 +398,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void Bug28777_EmptyFlush ()
{
MemoryStream backing = new MemoryStream ();
@@ -384,6 +409,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void Bug28777_DoubleFlush ()
{
byte[] buffer = new byte [4096];
@@ -397,6 +423,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void Bug34916_Inflate ()
{
var base64String = @"H4sIAAAAAAAAA6yVu27bQBBF/4VtZGHeD3ZJmhTp5C5IIUiEIcCWDEUugiD/nmEQwYRNURFAsuFwd2exZ++d+farud89davT+um5aRsC1DuEO+R7lJayRV9m5gegFqBZNB83m5fjevOzadGWUPHjaXd62XYVEy3Z04wiMTKIX0dfV0G/6FO3Pu72D/+iL916W9GbOV/X58SaS6zEKKyoGUA1eNg/nLfF2jUEBBNMtT4Wzeq567Z9HkZkE1Osf93msN/+WO32m+7zsavsh30/BUU8fy+uUCC+QIHpPQW1RAXkEGWUmSnUy2iUYSMYOGpARYViiIHcqY5kExS8rg2vY8gLGEjeYsClBVE4ORQHz3kxsEF4iS01xzBIZkgYQcYQQ7C54LQaIrxWn5+4ioT1BiRQN8Fh6MrOPjOS9Eh3M8YRJJQMZioJkUODFA8RNJ9AYuYBNyGJW5D0oi3/EpZ3dWYk5X5PN81RJGJgDATMQ5X02nFS1imVlMGvu0XwBg5/K1hY1U8tecxcNDy1/FAnG+OAQSi9PliHRaNUiuoxQYFB6T8oyAUKEu9LJ6oipbr1spyZArhWX6qbi7EOUrs7SCAoDNVgzKagMlUz+q6DQ4N8/yM=";
@@ -415,6 +442,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void Bug44994_Inflate()
{
var base64String = @"7cWxCQAgDACwpeBjgqsgXiHU0fd9QzBLErX1EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADepcxcuU/atm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm3btm37zy8=";
@@ -434,6 +462,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[Category ("MobileNotWorking")]
public void Bug44994_InflateByteByByte()
{

View File

@@ -44,6 +44,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (ArgumentNullException))]
public void Constructor_Null ()
{
@@ -51,6 +52,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (ArgumentException))]
public void Constructor_InvalidCompressionMode ()
{
@@ -58,6 +60,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void CheckCompressDecompress ()
{
byte [] data = new byte[100000];
@@ -80,6 +83,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void CheckDecompress ()
{
byte [] data = {0x1f, 0x8b, 0x08, 0x08, 0x70, 0xbb, 0x5d, 0x41, 0x00, 0x03, 0x74, 0x65, 0x73, 0x74, 0x00, 0xf3, 0x48, 0xcd, 0xc9, 0xc9, 0xe7, 0x02, 0x00, 0x16, 0x35, 0x96, 0x31, 0x06, 0x00, 0x00, 0x00 };
@@ -91,6 +95,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (ArgumentNullException))]
public void CheckNullRead ()
{
@@ -101,6 +106,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (InvalidOperationException))]
public void CheckCompressingRead ()
{
@@ -111,6 +117,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (ArgumentException))]
public void CheckRangeRead ()
{
@@ -123,6 +130,7 @@ namespace MonoTests.System.IO.Compression
#if !MOBILE
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[Category("NotWorking")]
public void CheckInvalidDataRead ()
{
@@ -139,6 +147,7 @@ namespace MonoTests.System.IO.Compression
#endif
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void CheckClosedRead ()
{
byte [] dummy = new byte[20];
@@ -153,6 +162,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (ObjectDisposedException))]
public void CheckClosedFlush ()
{
@@ -163,6 +173,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (NotSupportedException))]
public void CheckSeek ()
{
@@ -172,6 +183,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (NotSupportedException))]
public void CheckSetLength ()
{
@@ -181,6 +193,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void CheckGetCanSeekProp ()
{
MemoryStream backing = new MemoryStream (compressed_data);
@@ -201,6 +214,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void CheckGetCanReadProp ()
{
MemoryStream backing = new MemoryStream (compressed_data);
@@ -221,6 +235,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void CheckGetCanWriteProp ()
{
MemoryStream backing = new MemoryStream (compressed_data);
@@ -241,6 +256,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (NotSupportedException))]
public void CheckSetLengthProp ()
{
@@ -250,6 +266,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (NotSupportedException))]
public void CheckGetLengthProp ()
{
@@ -259,6 +276,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[ExpectedException (typeof (NotSupportedException))]
public void CheckGetPositionProp ()
{
@@ -268,6 +286,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void DisposeTest ()
{
MemoryStream backing = new MemoryStream (compressed_data);
@@ -277,6 +296,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void DisposeOrderTest ()
{
var fs = new MemoryStream();
@@ -304,6 +324,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
public void CheckNet45Overloads () // Xambug #21982
{
MemoryStream dataStream = GenerateStreamFromString("Hello");

View File

@@ -74,6 +74,7 @@ namespace MonoTests.System.Net.NetworkInformation
}
[Test]
[Category ("InetAccess")]
public void AtLeastOneGatewayAddress ()
{
int numGatewayAddresses = 0;

View File

@@ -97,6 +97,7 @@ namespace MonoCasTests.System.Net.Sockets {
[Test]
[EnvironmentPermission (SecurityAction.Deny, Read = "USERNAME")]
[Category ("InetAccess")]
public void AsyncRead ()
{
message = "AsyncRead";
@@ -135,6 +136,7 @@ namespace MonoCasTests.System.Net.Sockets {
[Test]
[EnvironmentPermission (SecurityAction.Deny, Read = "USERNAME")]
[Category ("InetAccess")]
public void AsyncWrite ()
{
message = "AsyncWrite";

View File

@@ -16,6 +16,7 @@ using NUnit.Framework;
namespace MonoTests.System.Net.Sockets
{
[TestFixture]
[Category ("InetAccess")]
public class NetworkStreamTest
{
[Test]

View File

@@ -78,6 +78,7 @@ namespace MonoCasTests.System.Net.Sockets {
[Test]
[EnvironmentPermission (SecurityAction.Deny, Read = "USERNAME")]
[Category ("InetAccess")]
public void AsyncAccept ()
{
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 16279);
@@ -117,6 +118,7 @@ namespace MonoCasTests.System.Net.Sockets {
[Test]
[EnvironmentPermission (SecurityAction.Deny, Read = "USERNAME")]
[Category ("InetAccess")]
public void AsyncConnect ()
{
message = "AsyncConnect";
@@ -150,6 +152,7 @@ namespace MonoCasTests.System.Net.Sockets {
[Test]
[EnvironmentPermission (SecurityAction.Deny, Read = "USERNAME")]
[Category ("InetAccess")]
public void AsyncReceive ()
{
message = "AsyncReceive";
@@ -188,6 +191,7 @@ namespace MonoCasTests.System.Net.Sockets {
[Test]
[EnvironmentPermission (SecurityAction.Deny, Read = "USERNAME")]
[Category ("InetAccess")]
public void AsyncReceiveFrom ()
{
message = "AsyncReceiveFrom";
@@ -226,6 +230,7 @@ namespace MonoCasTests.System.Net.Sockets {
[Test]
[EnvironmentPermission (SecurityAction.Deny, Read = "USERNAME")]
[Category ("InetAccess")]
public void AsyncSend ()
{
message = "AsyncSend";
@@ -260,6 +265,7 @@ namespace MonoCasTests.System.Net.Sockets {
[Test]
[EnvironmentPermission (SecurityAction.Deny, Read = "USERNAME")]
[Category ("InetAccess")]
public void AsyncSendTo ()
{
message = "AsyncSendTo";

View File

@@ -1 +1 @@
a6abbf59745f6290abaafc8709701260843a2813
a7fb500cd3e3e994306ab6d5b214aa8dd13a18ae

View File

@@ -70,6 +70,7 @@ namespace MonoCasTests.System.Net.Sockets {
[Test]
[EnvironmentPermission (SecurityAction.Deny, Read = "USERNAME")]
[Category ("InetAccess")]
public void AsyncConnect_StringIntAsyncCallbackObject ()
{
TcpClient s = new TcpClient ();
@@ -84,6 +85,7 @@ namespace MonoCasTests.System.Net.Sockets {
[Test]
[EnvironmentPermission (SecurityAction.Deny, Read = "USERNAME")]
[Category ("InetAccess")]
public void AsyncConnect_IPAddressIntAsyncCallbackObject ()
{
IPHostEntry host = Dns.Resolve ("www.google.com");
@@ -99,6 +101,7 @@ namespace MonoCasTests.System.Net.Sockets {
[Test]
[EnvironmentPermission (SecurityAction.Deny, Read = "USERNAME")]
[Category ("InetAccess")]
public void AsyncConnect_IPAddressArrayIntAsyncCallbackObject ()
{
IPHostEntry host = Dns.Resolve ("www.google.com");

View File

@@ -19,6 +19,7 @@ using NUnit.Framework;
namespace MonoTests.System.Net
{
[TestFixture]
[Category ("InetAccess")]
public class DnsTest
{
private String site1Name = "google-public-dns-a.google.com",

View File

@@ -389,6 +389,9 @@ namespace MonoTests.System.Net
#endif
public void DownloadFile2_v6 ()
{
if (!Socket.OSSupportsIPv6)
Assert.Ignore ("IPv6 not supported.");
// Some embedded FTP servers in Industrial Automation Hardware report
// the PWD using backslashes, but allow forward slashes for CWD.
DownloadFile (new ServerDownload (@"\Users\someuser", "/Users/someuser/", null, true));

View File

@@ -1 +1 @@
38359efd4dea398ec4208a18de96c46569ccbac1
4cabb0ca84eac14cc074c0d4c57ee60a33f65cad

View File

@@ -1220,6 +1220,7 @@ namespace MonoTests.System.Net
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif

View File

@@ -48,6 +48,7 @@ public class ServicePointManagerTest
[Test, ExpectedException (typeof (InvalidOperationException))]
[Category ("NotWorking")]
[Category ("InetAccess")]
public void MaxServicePointManagers ()
{
Assert.AreEqual (0, ServicePointManager.MaxServicePoints, "#1");
@@ -85,7 +86,8 @@ public class ServicePointManagerTest
//WriteServicePoint (sp);
}
[Test]
[Test]
[Category ("InetAccess")]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif

View File

@@ -46,6 +46,7 @@ namespace MonoTests.System.Net
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (WebException))] // Something catches the PlatformNotSupportedException and re-throws an WebException
#endif
[Category ("InetAccess")]
public void DownloadTwice ()
{
WebClient wc = new WebClient();

View File

@@ -82,6 +82,7 @@ namespace MonoTests.System.Net
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (AggregateException))] // Something catches the PlatformNotSupportedException and re-throws an AggregateException
#endif
[Category("InetAccess")]
public void DownloadFileTaskAsync ()
{
WebClient wc = new WebClient ();
@@ -96,6 +97,7 @@ namespace MonoTests.System.Net
[Test]
[Category ("NotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
[Category("InetAccess")]
public void Cancellation ()
{
WebClient wc = new WebClient ();
@@ -123,6 +125,7 @@ namespace MonoTests.System.Net
[Test]
[Category ("NotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
[Category("InetAccess")]
public void DownloadMultiple ()
{
WebClient wc = new WebClient ();
@@ -140,6 +143,7 @@ namespace MonoTests.System.Net
}
[Test]
[Category ("InetAccess")]
[Category ("NotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
public void DownloadMultiple2 ()
{
@@ -152,6 +156,7 @@ namespace MonoTests.System.Net
}
[Test]
[Category ("InetAccess")]
[Category ("NotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
public void DownloadMultiple3 ()
{

View File

@@ -205,6 +205,7 @@ namespace MonoTests.System.Security.Cryptography.X509Certificates {
}
[Test]
[Category ("InetAccess")]
public void Build_Cert1_X509RevocationMode_Online ()
{
X509Chain c = new X509Chain ();

View File

@@ -502,20 +502,14 @@ namespace MonoTests.System
uri = new Uri ("file:////////cygwin/tmp/hello.txt");
Assert.AreEqual ("file://cygwin/tmp/hello.txt", uri.ToString (), "#3a");
if (isWin32)
Assert.AreEqual ("\\\\cygwin\\tmp\\hello.txt", uri.LocalPath, "#3b win32");
else
Assert.AreEqual ("/tmp/hello.txt", uri.LocalPath, "#3b *nix");
Assert.AreEqual ("\\\\cygwin\\tmp\\hello.txt", uri.LocalPath, "#3b win32");
Assert.AreEqual ("file", uri.Scheme, "#3c");
Assert.AreEqual ("cygwin", uri.Host, "#3d");
Assert.AreEqual ("/tmp/hello.txt", uri.AbsolutePath, "#3e");
uri = new Uri ("file://mymachine/cygwin/tmp/hello.txt");
Assert.AreEqual ("file://mymachine/cygwin/tmp/hello.txt", uri.ToString (), "#4a");
if (isWin32)
Assert.AreEqual ("\\\\mymachine\\cygwin\\tmp\\hello.txt", uri.LocalPath, "#4b win32");
else
Assert.AreEqual ("/cygwin/tmp/hello.txt", uri.LocalPath, "#4b *nix");
Assert.AreEqual ("\\\\mymachine\\cygwin\\tmp\\hello.txt", uri.LocalPath, "#4b win32");
Assert.AreEqual ("file", uri.Scheme, "#4c");
Assert.AreEqual ("mymachine", uri.Host, "#4d");
Assert.AreEqual ("/cygwin/tmp/hello.txt", uri.AbsolutePath, "#4e");
@@ -537,10 +531,7 @@ namespace MonoTests.System
Assert.AreEqual ("/", uri.AbsolutePath, "#6e");
Assert.AreEqual ("/", uri.PathAndQuery, "#6f");
Assert.AreEqual ("file://one_file.txt/", uri.GetLeftPart (UriPartial.Path), "#6g");
if (isWin32)
Assert.AreEqual ("\\\\one_file.txt", uri.LocalPath, "#6b");
else
Assert.AreEqual ("/", uri.LocalPath, "#6b");
Assert.AreEqual ("\\\\one_file.txt", uri.LocalPath, "#6b");
Assert.AreEqual ("file", uri.Scheme, "#6c");
Assert.AreEqual ("one_file.txt", uri.Host, "#6d");
@@ -551,10 +542,7 @@ namespace MonoTests.System
Assert.AreEqual ("/", uri.AbsolutePath, "#7e");
Assert.AreEqual ("/", uri.PathAndQuery, "#7f");
Assert.AreEqual ("file://one_file.txt/", uri.GetLeftPart (UriPartial.Path), "#7g");
if (isWin32)
Assert.AreEqual ("\\\\one_file.txt\\", uri.LocalPath, "#7b");
else
Assert.AreEqual ("/", uri.LocalPath, "#7b");
Assert.AreEqual ("\\\\one_file.txt\\", uri.LocalPath, "#7b");
Assert.AreEqual ("file", uri.Scheme, "#7c");
Assert.AreEqual ("one_file.txt", uri.Host, "#7d");
}
@@ -2071,5 +2059,16 @@ namespace MonoTests.System
var uri = new Uri ("https://_foo/bar.html");
Assert.AreEqual ("https", uri.Scheme);
}
[Test]
public void ImplicitUnixFileWithUnicodeGetAbsoluleUri ()
{
if (isWin32)
Assert.Ignore ();
string escFilePath = "/Users/Текст.txt";
string escUrl = new Uri (escFilePath, UriKind.Absolute).AbsoluteUri;
Assert.AreEqual ("file:///Users/%D0%A2%D0%B5%D0%BA%D1%81%D1%82.txt", escUrl);
}
}
}

View File

@@ -875,7 +875,7 @@ TextWriter sw = Console.Out;
if (IriParsing) {
Assert.AreEqual ("/dir/subdir/file", uri.AbsolutePath, "AbsolutePath");
Assert.AreEqual ("file://host/dir/subdir/file?this-is-not-a-query#but-this-is-a-fragment", uri.AbsoluteUri, "AbsoluteUri");
Assert.AreEqual (isWin32 ? "\\\\host\\dir\\subdir\\file" : "/dir/subdir/file", uri.LocalPath, "LocalPath");
Assert.AreEqual ("\\\\host\\dir\\subdir\\file", uri.LocalPath, "LocalPath");
Assert.AreEqual ("/dir/subdir/file?this-is-not-a-query", uri.PathAndQuery, "PathAndQuery");
Assert.AreEqual ("?this-is-not-a-query", uri.Query, "Query");
Assert.AreEqual ("file", uri.Segments [3], "Segments [3]");

View File

@@ -696,6 +696,38 @@ namespace MonoTests.System
type = Uri.CheckHostName ("3.141592653589793238462643383279502884197169399375105820974944592._om");
Assert.AreEqual (UriHostNameType.Unknown, type, "DomainLabelLength#3");
}
// https://bugzilla.xamarin.com/show_bug.cgi?id=58400
[Test]
public static void Test_LocalPath_Bug58400()
{
var uriAndExpected = new []
{
("file://host/directory/filename", @"\\host\directory\filename"),
("file://host/directory/", @"\\host\directory\"),
("file://host/filename", @"\\host\filename"),
("file://host/", @"\\host\"),
("file://host", @"\\host"),
("file:///directory/filename", "/directory/filename"),
("file:///directory/", "/directory/"),
("file:///filename", "/filename"),
("file:///", "/"),
// This is an invalid URI, technically
("file://", "/"),
("file://////hello/world", @"\\hello\world"),
("file://hello/////world", @"\\hello\\\\\world"),
};
foreach (var tup in uriAndExpected)
{
var originalUri = tup.Item1;
var expectedLocalPath = tup.Item2;
var uri = new Uri (originalUri);
var localPath = uri.LocalPath;
Assert.AreEqual (expectedLocalPath, localPath, originalUri);
}
}
}
}