X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FSystem%2FTest%2FSystem%2FUriTest.cs;h=5062dc3d56986cb40ffa50ce052c2c77fbfa026d;hb=54fffdda0197b6ae944c62a6cc7b0f96e15a3149;hp=80215ed6d2861668681ef58e0d40bc90eb7c8518;hpb=8ff6566f13617602cad23b9d1ac1d620d49f5fb2;p=mono.git diff --git a/mcs/class/System/Test/System/UriTest.cs b/mcs/class/System/Test/System/UriTest.cs index 80215ed6d28..5062dc3d569 100644 --- a/mcs/class/System/Test/System/UriTest.cs +++ b/mcs/class/System/Test/System/UriTest.cs @@ -316,18 +316,6 @@ namespace MonoTests.System Assert ("#7", !uri.IsUnc); } - [Test] - [Ignore ("Known to fail under MS runtime")] - public void Unc2 () - { - try { - Uri uri = new Uri ("file:/filename.ext"); - Assert ("#4", uri.IsUnc); - } catch (UriFormatException) { - Fail ("#5: known to fail with ms.net"); - } - } - [Test] public void FromHex () { @@ -497,25 +485,17 @@ namespace MonoTests.System } [Test] - [Ignore("Known to fail under MS runtime")] - public void GetLeftPart2 () + [ExpectedException(typeof(UriFormatException))] + public void IncompleteSchemeDelimiter () { - try { - Uri uri = new Uri ("file:/filename.ext"); - AssertEquals ("#16", "file://", uri.GetLeftPart (UriPartial.Scheme)); - AssertEquals ("#17", "", uri.GetLeftPart (UriPartial.Authority)); - AssertEquals ("#18", "file:///filename.ext", uri.GetLeftPart (UriPartial.Path)); - } catch (UriFormatException) { - Fail ("#19: known to fail with ms.net (it's their own example!)"); - } + new Uri ("file:/filename.ext"); } [Test] [Category("NotDotNet")] public void CheckHostName1 () { - AssertEquals ("#11: known to fail with ms.net: this is not a valid domain address", UriHostNameType.Unknown, Uri.CheckHostName ("www.contoso.com.")); - AssertEquals ("#33 known to fail with ms.net: this is not a valid IPv6 address.", UriHostNameType.Unknown, Uri.CheckHostName ("2001::03A0:1.2.3.4")); + // reported to MSDN Product Feedback Center (FDBK28671) AssertEquals ("#36 known to fail with ms.net: this is not a valid IPv6 address.", UriHostNameType.Unknown, Uri.CheckHostName (":11:22:33:44:55:66:77:88")); } @@ -532,6 +512,7 @@ namespace MonoTests.System AssertEquals ("#8", UriHostNameType.Dns, Uri.CheckHostName ("9001.002.03.4")); AssertEquals ("#9", UriHostNameType.Dns, Uri.CheckHostName ("www.contoso.com")); AssertEquals ("#10", UriHostNameType.Unknown, Uri.CheckHostName (".www.contoso.com")); + AssertEquals ("#11", UriHostNameType.Dns, Uri.CheckHostName ("www.contoso.com.")); AssertEquals ("#12", UriHostNameType.Dns, Uri.CheckHostName ("www.con-toso.com")); AssertEquals ("#13", UriHostNameType.Dns, Uri.CheckHostName ("www.con_toso.com")); AssertEquals ("#14", UriHostNameType.Unknown, Uri.CheckHostName ("www.con,toso.com")); @@ -553,6 +534,7 @@ namespace MonoTests.System AssertEquals ("#28", UriHostNameType.IPv6, Uri.CheckHostName ("::ffFF:169.32.14.5")); AssertEquals ("#29", UriHostNameType.IPv6, Uri.CheckHostName ("2001:03A0::/35")); AssertEquals ("#30", UriHostNameType.IPv6, Uri.CheckHostName ("[2001:03A0::/35]")); + AssertEquals ("#33", UriHostNameType.IPv6, Uri.CheckHostName ("2001::03A0:1.2.3.4")); AssertEquals ("#31", UriHostNameType.Unknown, Uri.CheckHostName ("2001::03A0::/35")); AssertEquals ("#32", UriHostNameType.Unknown, Uri.CheckHostName ("2001:03A0::/35a")); @@ -569,17 +551,7 @@ namespace MonoTests.System } [Test] - [Category("NotDotNet")] - public void IsLoopback1 () - { - Uri uri = new Uri("http://[0:0:0:0::127.11.22.33]:8080"); - Assert ("#10: known to fail with ms.net", uri.IsLoopback); - uri = new Uri("http://[::ffff:127.11.22.33]:8080"); - Assert ("#11: known to fail with ms.net", uri.IsLoopback); - } - - [Test] - public void IsLoopback2 () + public void IsLoopback () { Uri uri = new Uri("http://loopback:8080"); AssertEquals ("#1", true, uri.IsLoopback); @@ -599,6 +571,10 @@ namespace MonoTests.System AssertEquals ("#8", true, uri.IsLoopback); uri = new Uri("http://[0:0:0:0::127.0.0.1]:8080"); AssertEquals ("#9", true, uri.IsLoopback); + uri = new Uri("http://[0:0:0:0::127.11.22.33]:8080"); + AssertEquals ("#10", false, uri.IsLoopback); + uri = new Uri("http://[::ffff:127.11.22.33]:8080"); + AssertEquals ("#11", false, uri.IsLoopback); uri = new Uri("http://[::ff00:7f11:2233]:8080"); AssertEquals ("#12", false, uri.IsLoopback); uri = new Uri("http://[1:0:0:0::1]:8080"); @@ -606,22 +582,24 @@ namespace MonoTests.System } [Test] - [Category("NotDotNet")] public void Equals1 () { Uri uri1 = new Uri ("http://www.contoso.com/index.htm#main"); - Uri uri2 = new Uri ("http://www.contoso.com/index.htm?x=1"); - Assert ("#2 known to fail with ms.net", !uri1.Equals (uri2)); - Assert ("#4: known to fail with ms.net", !uri1.Equals ("http://www.contoso.com:8080/index.htm?x=1")); + Uri uri2 = new Uri ("http://www.contoso.com/index.htm#fragment"); + Assert ("#1", uri1.Equals (uri2)); + Assert ("#3", !uri2.Equals ("http://www.contoso.com/index.html?x=1")); + Assert ("#4", !uri1.Equals ("http://www.contoso.com:8080/index.htm?x=1")); } [Test] +#if !NET_2_0 + [Category("NotDotNet")] +#endif public void Equals2 () { Uri uri1 = new Uri ("http://www.contoso.com/index.htm#main"); - Uri uri2 = new Uri ("http://www.contoso.com/index.htm#fragment"); - Assert ("#1", uri1.Equals (uri2)); - Assert ("#3", !uri2.Equals ("http://www.contoso.com/index.html?x=1")); + Uri uri2 = new Uri ("http://www.contoso.com/index.htm?x=1"); + Assert ("#2 known to fail with ms.net 1.x", !uri1.Equals (uri2)); } [Test] @@ -732,11 +710,33 @@ namespace MonoTests.System } [Test] - [ExpectedException (typeof (UriFormatException))] - [Ignore ("MS throws an IndexOutOfRangeException. Bug?")] +#if !NET_2_0 + // MS.NET 1.x throws an IndexOutOfRangeException + [Category("NotDotNet")] +#endif + [Ignore("Bug #74144")] public void NoHostname2 () { Uri uri = new Uri ("file://"); + AssertEquals ("#1", true, uri.IsFile); + AssertEquals ("#2", false, uri.IsUnc); + AssertEquals ("#3", "file", uri.Scheme); + AssertEquals ("#4", "/", uri.LocalPath); + AssertEquals ("#5", string.Empty, uri.Query); + AssertEquals ("#6", "/", uri.AbsolutePath); + AssertEquals ("#7", "file:///", uri.AbsoluteUri); + AssertEquals ("#8", string.Empty, uri.Authority); + AssertEquals ("#9", string.Empty, uri.Host); + AssertEquals ("#10", UriHostNameType.Basic, uri.HostNameType); + AssertEquals ("#11", string.Empty, uri.Fragment); + AssertEquals ("#12", true, uri.IsDefaultPort); + AssertEquals ("#13", true, uri.IsLoopback); + AssertEquals ("#14", "/", uri.PathAndQuery); + AssertEquals ("#15", false, uri.UserEscaped); + AssertEquals ("#16", string.Empty, uri.UserInfo); + AssertEquals ("#17", "file://", uri.GetLeftPart (UriPartial.Authority)); + AssertEquals ("#18", "file:///", uri.GetLeftPart (UriPartial.Path)); + AssertEquals ("#19", "file://", uri.GetLeftPart (UriPartial.Scheme)); } [Test]