+2003-12-08 Atsushi Enomoto <atsushi@novell.com>
+
+ * Added uri-test-generator.cs, test-uri-list.txt, test-uri-props.txt
+ and UriTest2.cs. They are test generator files.
+
2003-12-08 Ravindra <rkumar@novell.com>
* UriTest.cs: Added IsUnc tests for local file paths.
--- /dev/null
+using System;\r
+using System.IO;\r
+using System.Text;\r
+using NUnit.Framework;\r
+\r
+namespace MonoTests.System\r
+{\r
+ [TestFixture]\r
+ public class UriTest2 : Assertion\r
+ {\r
+ // Segments cannot be validated here...\r
+ public void AssertUri (Uri uri,\r
+ string toString,\r
+ string absoluteUri,\r
+ string scheme,\r
+ string host,\r
+ string localPath,\r
+ string query,\r
+ int port,\r
+ bool isFile,\r
+ bool isUnc,\r
+ bool isLoopback,\r
+ bool userEscaped,\r
+ UriHostNameType hostNameType,\r
+ string absolutePath,\r
+ string pathAndQuery,\r
+ string authority,\r
+ string fragment,\r
+ string userInfo)\r
+ {\r
+ AssertEquals ("AbsoluteUri", absoluteUri, uri.AbsoluteUri);\r
+ AssertEquals ("Scheme", scheme, uri.Scheme);\r
+ AssertEquals ("Host", host, uri.Host);\r
+ AssertEquals ("Port", port, uri.Port);\r
+ AssertEquals ("LocalPath", localPath, uri.LocalPath);\r
+ AssertEquals ("query", query, uri.Query);\r
+ AssertEquals ("Fragment", fragment, uri.Fragment);\r
+ AssertEquals ("IsFile", isFile, uri.IsFile);\r
+ AssertEquals ("IsUnc", isUnc, uri.IsUnc);\r
+ AssertEquals ("IsLoopback", isLoopback, uri.IsLoopback);\r
+ AssertEquals ("authority", authority, uri.Authority);\r
+ AssertEquals ("UserEscaped", userEscaped, uri.UserEscaped);\r
+ AssertEquals ("UserInfo", userInfo, uri.UserInfo);\r
+ AssertEquals ("HostNameType", hostNameType, uri.HostNameType);\r
+ AssertEquals ("AbsolutePath", absolutePath, uri.AbsolutePath);\r
+ AssertEquals ("PathAndQuery", pathAndQuery, uri.PathAndQuery);\r
+ AssertEquals ("ToString()", toString, uri.ToString ());\r
+ }\r
+\r
+ [Test]\r
+ public void TestFromFile ()\r
+ {\r
+ StreamReader sr = new StreamReader ("System/test-uri-props.txt", Encoding.UTF8);\r
+ while (sr.Peek () > 0) {\r
+ sr.ReadLine (); // skip\r
+ string uriString = sr.ReadLine ();\r
+TextWriter sw = Console.Out;\r
+ sw.WriteLine ("-------------------------");\r
+ sw.WriteLine (uriString);\r
+\r
+ if (uriString == null || uriString.Length == 0)\r
+ break;\r
+\r
+ Uri uri = new Uri (uriString);\r
+\r
+ sw.WriteLine ("ToString(): " + uri.ToString ());\r
+ sw.WriteLine (uri.AbsoluteUri);\r
+ sw.WriteLine (uri.Scheme);\r
+ sw.WriteLine (uri.Host);\r
+ sw.WriteLine (uri.LocalPath);\r
+ sw.WriteLine (uri.Query);\r
+ sw.WriteLine ("Port: " + uri.Port);\r
+ sw.WriteLine (uri.IsFile);\r
+ sw.WriteLine (uri.IsUnc);\r
+ sw.WriteLine (uri.IsLoopback);\r
+ sw.WriteLine (uri.UserEscaped);\r
+ sw.WriteLine ("HostNameType: " + uri.HostNameType);\r
+ sw.WriteLine (uri.AbsolutePath);\r
+ sw.WriteLine ("PathAndQuery: " + uri.PathAndQuery);\r
+ sw.WriteLine (uri.Authority);\r
+ sw.WriteLine (uri.Fragment);\r
+ sw.WriteLine (uri.UserInfo);\r
+\r
+ AssertUri (uri,\r
+ sr.ReadLine (),\r
+ sr.ReadLine (),\r
+ sr.ReadLine (),\r
+ sr.ReadLine (),\r
+ sr.ReadLine (),\r
+ sr.ReadLine (),\r
+ int.Parse (sr.ReadLine ()),\r
+ bool.Parse (sr.ReadLine ()),\r
+ bool.Parse (sr.ReadLine ()),\r
+ bool.Parse (sr.ReadLine ()),\r
+ bool.Parse (sr.ReadLine ()),\r
+ (UriHostNameType) Enum.Parse (typeof (UriHostNameType), sr.ReadLine (), false),\r
+ sr.ReadLine (),\r
+ sr.ReadLine (),\r
+ sr.ReadLine (),\r
+ sr.ReadLine (),\r
+ sr.ReadLine ());\r
+ Console.WriteLine ("Passed: " + uriString);\r
+ }\r
+ }\r
+\r
+/*\r
+ public static void Main (string [] args)\r
+ {\r
+ StreamReader sr = new StreamReader ("test-uri-list.txt", Encoding.UTF8);\r
+ StreamWriter sw = new StreamWriter ("test-uri-props.txt", false, Encoding.UTF8);\r
+\r
+ GenerateResult (sr, sw, null);\r
+ }\r
+\r
+ public static void GenerateResult (TextReader sr, TextWriter sw, Uri baseUri)\r
+ {\r
+ while (sr.Peek () > 0) {\r
+ string uriString = sr.ReadLine ();\r
+ if (uriString.Length == 0 || uriString [0] == '#')\r
+ continue;\r
+ Uri uri = (baseUri == null) ?\r
+ new Uri (uriString) : new Uri (baseUri, uriString);\r
+\r
+ sw.WriteLine ("-------------------------");\r
+ sw.WriteLine (uriString);\r
+ sw.WriteLine (uri.ToString ());\r
+ sw.WriteLine (uri.AbsoluteUri);\r
+ sw.WriteLine (uri.Scheme);\r
+ sw.WriteLine (uri.Host);\r
+ sw.WriteLine (uri.LocalPath);\r
+ sw.WriteLine (uri.Query);\r
+ sw.WriteLine (uri.Port);\r
+ sw.WriteLine (uri.IsFile);\r
+ sw.WriteLine (uri.IsUnc);\r
+ sw.WriteLine (uri.IsLoopback);\r
+ sw.WriteLine (uri.UserEscaped);\r
+ sw.WriteLine (uri.HostNameType);\r
+ sw.WriteLine (uri.AbsolutePath);\r
+ sw.WriteLine (uri.PathAndQuery);\r
+ sw.WriteLine (uri.Authority);\r
+ sw.WriteLine (uri.Fragment);\r
+ sw.WriteLine (uri.UserInfo);\r
+ }\r
+ sr.Close ();\r
+ sw.Close ();\r
+ }\r
+*/\r
+\r
+ }\r
+}\r
--- /dev/null
+#
+# test-uri-list.txt : URI test input list
+#
+# Author:
+# Atsushi Enomoto <atushi@ximian.com>
+#
+# Usage:
+# You need Microsoft.NET to make use of this tool.
+# 1. compile uri-test-generator.cs and create uri-test-generator.exe.
+# 2. add whatever url string you want to test to this file.
+# (note that it can check only "correct" uri, which can pass on MS.NET).
+# 3. run uri-test-generator.exe. It will generate uri-test-props.txt.
+# 4. UriTest2 test class will load the new test file and check Uri class.
+#
+# It would be better to edit this file as utf-8 text. I put some
+# non-ASCII characters for tests (Japanese and Chinese traditional).
+#
+# Remember that
+# - relative URI are not allowed for input to Uri.ctor().
+# In some cases, it became ambiguous to parse. For example,
+# file://readme.txt is treated as file server whose host name is
+# "readme", domain name is "txt".
+#
+# - MS.NET does not conform to RFC 2396 in some places.
+#
+# - Uri escape is done inside System.Uri itself (unless you explicitly
+# specify dontEscape = true). This means that Uri.ctor() may allows
+# non RFC-conformant string. It accepts, and escapes internally.
+#
+http://server
+http://server/
+http://server/maybe_file
+http://server/directory/
+http://server.com
+http://server.com/
+http://server.com/maybe_file
+http://server.com/directory/
+# http:server ... should not be allowed
+c:/foo.txt
+c:\foo.txt
+file://c:/foo.txt
+# /usr/local/bin ... doesn't pass. it is critical problem of MS.NET
+\\server
+//server
+# ///server ... this became UNC server name in MS.NET
+file://server
+file://server/
+file://server/maybe_file
+file://server/directory/
+file://server.com
+## below should be treated as UNC server
+file://readme.txt
+file://server.com/
+# file:server.com
+# file:server.com/
+# file:server
+file://server.com/maybe_file
+file://server.com/directory/
+## Below are taken from UriTest.cs
+http://contoso.com?subject=uri
+mailto:user:pwd@contoso.com?subject=uri
+\\myserver\mydir\mysubdir\myfile.ext
+http://www.contoso.com
+http://www.contoso.com/foo/bar/index.html?x=0
+c:\tmp\hello.txt
+file:////////cygwin/tmp/hello.txt
+file://mymachine/cygwin/tmp/hello.txt
+file://///c:/cygwin/tmp/hello.txt
+file://one_file.txt
+file://cygwin/tmp/hello.txt
+file://server/filename.ext
+\\server\share\filename.ext
+http://1.2.3.4
+file://1.2.3.4
+# file:
+# http:
+# makefile
+# gopher:
+# ftp:
+# file:/
+# file://
+# file:/// ... however, should be allowed in Unix file path.
+# file://\
+# file://c:
+# file:///c: ... however, should be allowed in Windows file path.
+# news: ... in fact MS passes this.
+# Below should be allowed
+http://localhost/c#
+http://localhost/c#bookmark
+file://localhost/c#
+//localhost/c#
+# below should not be allowed ...
+file://c:/c#
+# this passes... it breaks RFC 2396 rule.
+http://c#
+mailto:c#
+http://c#bookmark
+#
+# non-standard scheme
+#
+urn:mono-uri-test
+# This "8080" is not a port specifier. This is "opaque part" (RFC 2396)
+urn:mono-uri-test:8080
+# But here, it is interpreted as a host name.
+urn://mono-uri-test:8080
+# Scheme cannot start with non-alphabetic character, but MS fails to reject
+ファイル:myserver/foo.txt
+ファイル://myserver/foo.txt
+辭典://cn_to_ja/
+#
+# still looks TODO (EscapeString)
+#
+http://web.app.com/test.cgi?value=あいうえお
+辭典:cn_to_ja/ファイル
+ファイル:
+辭典:
+#
+#
+# MS.NET supplies no host info (consoto.com), but I think Mono is better.
+# news:123456@contoso.com
--- /dev/null
+-------------------------\r
+http://server\r
+http://server/\r
+http://server/\r
+http\r
+server\r
+/\r
+\r
+80\r
+False\r
+False\r
+False\r
+False\r
+Dns\r
+/\r
+/\r
+server\r
+\r
+\r
+-------------------------\r
+http://server/\r
+http://server/\r
+http://server/\r
+http\r
+server\r
+/\r
+\r
+80\r
+False\r
+False\r
+False\r
+False\r
+Dns\r
+/\r
+/\r
+server\r
+\r
+\r
+-------------------------\r
+http://server/maybe_file\r
+http://server/maybe_file\r
+http://server/maybe_file\r
+http\r
+server\r
+/maybe_file\r
+\r
+80\r
+False\r
+False\r
+False\r
+False\r
+Dns\r
+/maybe_file\r
+/maybe_file\r
+server\r
+\r
+\r
+-------------------------\r
+http://server/directory/\r
+http://server/directory/\r
+http://server/directory/\r
+http\r
+server\r
+/directory/\r
+\r
+80\r
+False\r
+False\r
+False\r
+False\r
+Dns\r
+/directory/\r
+/directory/\r
+server\r
+\r
+\r
+-------------------------\r
+http://server.com\r
+http://server.com/\r
+http://server.com/\r
+http\r
+server.com\r
+/\r
+\r
+80\r
+False\r
+False\r
+False\r
+False\r
+Dns\r
+/\r
+/\r
+server.com\r
+\r
+\r
+-------------------------\r
+http://server.com/\r
+http://server.com/\r
+http://server.com/\r
+http\r
+server.com\r
+/\r
+\r
+80\r
+False\r
+False\r
+False\r
+False\r
+Dns\r
+/\r
+/\r
+server.com\r
+\r
+\r
+-------------------------\r
+http://server.com/maybe_file\r
+http://server.com/maybe_file\r
+http://server.com/maybe_file\r
+http\r
+server.com\r
+/maybe_file\r
+\r
+80\r
+False\r
+False\r
+False\r
+False\r
+Dns\r
+/maybe_file\r
+/maybe_file\r
+server.com\r
+\r
+\r
+-------------------------\r
+http://server.com/directory/\r
+http://server.com/directory/\r
+http://server.com/directory/\r
+http\r
+server.com\r
+/directory/\r
+\r
+80\r
+False\r
+False\r
+False\r
+False\r
+Dns\r
+/directory/\r
+/directory/\r
+server.com\r
+\r
+\r
+-------------------------\r
+c:/foo.txt\r
+file:///c:/foo.txt\r
+file:///c:/foo.txt\r
+file\r
+\r
+c:\foo.txt\r
+\r
+-1\r
+True\r
+False\r
+False\r
+False\r
+Basic\r
+c:/foo.txt\r
+c:/foo.txt\r
+\r
+\r
+\r
+-------------------------\r
+c:\foo.txt\r
+file:///c:/foo.txt\r
+file:///c:/foo.txt\r
+file\r
+\r
+c:\foo.txt\r
+\r
+-1\r
+True\r
+False\r
+False\r
+False\r
+Basic\r
+c:/foo.txt\r
+c:/foo.txt\r
+\r
+\r
+\r
+-------------------------\r
+file://c:/foo.txt\r
+file:///c:/foo.txt\r
+file:///c:/foo.txt\r
+file\r
+\r
+c:\foo.txt\r
+\r
+-1\r
+True\r
+False\r
+False\r
+False\r
+Basic\r
+c:/foo.txt\r
+c:/foo.txt\r
+\r
+\r
+\r
+-------------------------\r
+\\server\r
+file://server\r
+file://server\r
+file\r
+server\r
+\\server\r
+\r
+-1\r
+True\r
+True\r
+False\r
+False\r
+Dns\r
+\r
+\r
+server\r
+\r
+\r
+-------------------------\r
+//server\r
+file://server\r
+file://server\r
+file\r
+server\r
+\\server\r
+\r
+-1\r
+True\r
+True\r
+False\r
+False\r
+Dns\r
+\r
+\r
+server\r
+\r
+\r
+-------------------------\r
+file://server\r
+file://server\r
+file://server\r
+file\r
+server\r
+\\server\r
+\r
+-1\r
+True\r
+True\r
+False\r
+False\r
+Dns\r
+\r
+\r
+server\r
+\r
+\r
+-------------------------\r
+file://server/\r
+file://server/\r
+file://server/\r
+file\r
+server\r
+\\server\\r
+\r
+-1\r
+True\r
+True\r
+False\r
+False\r
+Dns\r
+/\r
+/\r
+server\r
+\r
+\r
+-------------------------\r
+file://server/maybe_file\r
+file://server/maybe_file\r
+file://server/maybe_file\r
+file\r
+server\r
+\\server\maybe_file\r
+\r
+-1\r
+True\r
+True\r
+False\r
+False\r
+Dns\r
+/maybe_file\r
+/maybe_file\r
+server\r
+\r
+\r
+-------------------------\r
+file://server/directory/\r
+file://server/directory/\r
+file://server/directory/\r
+file\r
+server\r
+\\server\directory\\r
+\r
+-1\r
+True\r
+True\r
+False\r
+False\r
+Dns\r
+/directory/\r
+/directory/\r
+server\r
+\r
+\r
+-------------------------\r
+file://server.com\r
+file://server.com\r
+file://server.com\r
+file\r
+server.com\r
+\\server.com\r
+\r
+-1\r
+True\r
+True\r
+False\r
+False\r
+Dns\r
+\r
+\r
+server.com\r
+\r
+\r
+-------------------------\r
+file://readme.txt\r
+file://readme.txt\r
+file://readme.txt\r
+file\r
+readme.txt\r
+\\readme.txt\r
+\r
+-1\r
+True\r
+True\r
+False\r
+False\r
+Dns\r
+\r
+\r
+readme.txt\r
+\r
+\r
+-------------------------\r
+file://server.com/\r
+file://server.com/\r
+file://server.com/\r
+file\r
+server.com\r
+\\server.com\\r
+\r
+-1\r
+True\r
+True\r
+False\r
+False\r
+Dns\r
+/\r
+/\r
+server.com\r
+\r
+\r
+-------------------------\r
+file://server.com/maybe_file\r
+file://server.com/maybe_file\r
+file://server.com/maybe_file\r
+file\r
+server.com\r
+\\server.com\maybe_file\r
+\r
+-1\r
+True\r
+True\r
+False\r
+False\r
+Dns\r
+/maybe_file\r
+/maybe_file\r
+server.com\r
+\r
+\r
+-------------------------\r
+file://server.com/directory/\r
+file://server.com/directory/\r
+file://server.com/directory/\r
+file\r
+server.com\r
+\\server.com\directory\\r
+\r
+-1\r
+True\r
+True\r
+False\r
+False\r
+Dns\r
+/directory/\r
+/directory/\r
+server.com\r
+\r
+\r
+-------------------------\r
+http://contoso.com?subject=uri\r
+http://contoso.com/?subject=uri\r
+http://contoso.com/?subject=uri\r
+http\r
+contoso.com\r
+/\r
+?subject=uri\r
+80\r
+False\r
+False\r
+False\r
+False\r
+Dns\r
+/\r
+/?subject=uri\r
+contoso.com\r
+\r
+\r
+-------------------------\r
+mailto:user:pwd@contoso.com?subject=uri\r
+mailto:user:pwd@contoso.com?subject=uri\r
+mailto:user:pwd@contoso.com?subject=uri\r
+mailto\r
+contoso.com\r
+\r
+?subject=uri\r
+25\r
+False\r
+False\r
+False\r
+False\r
+Dns\r
+\r
+?subject=uri\r
+contoso.com\r
+\r
+user:pwd\r
+-------------------------\r
+\\myserver\mydir\mysubdir\myfile.ext\r
+file://myserver/mydir/mysubdir/myfile.ext\r
+file://myserver/mydir/mysubdir/myfile.ext\r
+file\r
+myserver\r
+\\myserver\mydir\mysubdir\myfile.ext\r
+\r
+-1\r
+True\r
+True\r
+False\r
+False\r
+Dns\r
+/mydir/mysubdir/myfile.ext\r
+/mydir/mysubdir/myfile.ext\r
+myserver\r
+\r
+\r
+-------------------------\r
+http://www.contoso.com\r
+http://www.contoso.com/\r
+http://www.contoso.com/\r
+http\r
+www.contoso.com\r
+/\r
+\r
+80\r
+False\r
+False\r
+False\r
+False\r
+Dns\r
+/\r
+/\r
+www.contoso.com\r
+\r
+\r
+-------------------------\r
+http://www.contoso.com/foo/bar/index.html?x=0\r
+http://www.contoso.com/foo/bar/index.html?x=0\r
+http://www.contoso.com/foo/bar/index.html?x=0\r
+http\r
+www.contoso.com\r
+/foo/bar/index.html\r
+?x=0\r
+80\r
+False\r
+False\r
+False\r
+False\r
+Dns\r
+/foo/bar/index.html\r
+/foo/bar/index.html?x=0\r
+www.contoso.com\r
+\r
+\r
+-------------------------\r
+c:\tmp\hello.txt\r
+file:///c:/tmp/hello.txt\r
+file:///c:/tmp/hello.txt\r
+file\r
+\r
+c:\tmp\hello.txt\r
+\r
+-1\r
+True\r
+False\r
+False\r
+False\r
+Basic\r
+c:/tmp/hello.txt\r
+c:/tmp/hello.txt\r
+\r
+\r
+\r
+-------------------------\r
+file:////////cygwin/tmp/hello.txt\r
+file://cygwin/tmp/hello.txt\r
+file://cygwin/tmp/hello.txt\r
+file\r
+cygwin\r
+\\cygwin\tmp\hello.txt\r
+\r
+-1\r
+True\r
+True\r
+False\r
+False\r
+Dns\r
+/tmp/hello.txt\r
+/tmp/hello.txt\r
+cygwin\r
+\r
+\r
+-------------------------\r
+file://mymachine/cygwin/tmp/hello.txt\r
+file://mymachine/cygwin/tmp/hello.txt\r
+file://mymachine/cygwin/tmp/hello.txt\r
+file\r
+mymachine\r
+\\mymachine\cygwin\tmp\hello.txt\r
+\r
+-1\r
+True\r
+True\r
+False\r
+False\r
+Dns\r
+/cygwin/tmp/hello.txt\r
+/cygwin/tmp/hello.txt\r
+mymachine\r
+\r
+\r
+-------------------------\r
+file://///c:/cygwin/tmp/hello.txt\r
+file:///c:/cygwin/tmp/hello.txt\r
+file:///c:/cygwin/tmp/hello.txt\r
+file\r
+\r
+c:\cygwin\tmp\hello.txt\r
+\r
+-1\r
+True\r
+False\r
+False\r
+False\r
+Basic\r
+c:/cygwin/tmp/hello.txt\r
+c:/cygwin/tmp/hello.txt\r
+\r
+\r
+\r
+-------------------------\r
+file://one_file.txt\r
+file://one_file.txt\r
+file://one_file.txt\r
+file\r
+one_file.txt\r
+\\one_file.txt\r
+\r
+-1\r
+True\r
+True\r
+False\r
+False\r
+Dns\r
+\r
+\r
+one_file.txt\r
+\r
+\r
+-------------------------\r
+file://cygwin/tmp/hello.txt\r
+file://cygwin/tmp/hello.txt\r
+file://cygwin/tmp/hello.txt\r
+file\r
+cygwin\r
+\\cygwin\tmp\hello.txt\r
+\r
+-1\r
+True\r
+True\r
+False\r
+False\r
+Dns\r
+/tmp/hello.txt\r
+/tmp/hello.txt\r
+cygwin\r
+\r
+\r
+-------------------------\r
+file://server/filename.ext\r
+file://server/filename.ext\r
+file://server/filename.ext\r
+file\r
+server\r
+\\server\filename.ext\r
+\r
+-1\r
+True\r
+True\r
+False\r
+False\r
+Dns\r
+/filename.ext\r
+/filename.ext\r
+server\r
+\r
+\r
+-------------------------\r
+\\server\share\filename.ext\r
+file://server/share/filename.ext\r
+file://server/share/filename.ext\r
+file\r
+server\r
+\\server\share\filename.ext\r
+\r
+-1\r
+True\r
+True\r
+False\r
+False\r
+Dns\r
+/share/filename.ext\r
+/share/filename.ext\r
+server\r
+\r
+\r
+-------------------------\r
+http://1.2.3.4\r
+http://1.2.3.4/\r
+http://1.2.3.4/\r
+http\r
+1.2.3.4\r
+/\r
+\r
+80\r
+False\r
+False\r
+False\r
+False\r
+IPv4\r
+/\r
+/\r
+1.2.3.4\r
+\r
+\r
+-------------------------\r
+file://1.2.3.4\r
+file://1.2.3.4\r
+file://1.2.3.4\r
+file\r
+1.2.3.4\r
+\\1.2.3.4\r
+\r
+-1\r
+True\r
+True\r
+False\r
+False\r
+IPv4\r
+\r
+\r
+1.2.3.4\r
+\r
+\r
+-------------------------\r
+http://localhost/c#\r
+http://localhost/c#\r
+http://localhost/c#\r
+http\r
+localhost\r
+/c\r
+\r
+80\r
+False\r
+False\r
+True\r
+False\r
+Dns\r
+/c\r
+/c\r
+localhost\r
+#\r
+\r
+-------------------------\r
+http://localhost/c#bookmark\r
+http://localhost/c#bookmark\r
+http://localhost/c#bookmark\r
+http\r
+localhost\r
+/c\r
+\r
+80\r
+False\r
+False\r
+True\r
+False\r
+Dns\r
+/c\r
+/c\r
+localhost\r
+#bookmark\r
+\r
+-------------------------\r
+file://localhost/c#\r
+file://localhost/c#\r
+file://localhost/c#\r
+file\r
+localhost\r
+\\localhost\c\r
+\r
+-1\r
+True\r
+True\r
+True\r
+False\r
+Dns\r
+/c\r
+/c\r
+localhost\r
+#\r
+\r
+-------------------------\r
+//localhost/c#\r
+file://localhost/c%23\r
+file://localhost/c%23\r
+file\r
+localhost\r
+\\localhost\c#\r
+\r
+-1\r
+True\r
+True\r
+True\r
+False\r
+Dns\r
+/c%23\r
+/c%23\r
+localhost\r
+\r
+\r
+-------------------------\r
+file://c:/c#\r
+file:///c:/c#\r
+file:///c:/c#\r
+file\r
+\r
+c:\c\r
+\r
+-1\r
+True\r
+False\r
+False\r
+False\r
+Basic\r
+c:/c\r
+c:/c\r
+\r
+#\r
+\r
+-------------------------\r
+http://c#\r
+http://c/#\r
+http://c/#\r
+http\r
+c\r
+/\r
+\r
+80\r
+False\r
+False\r
+False\r
+False\r
+Dns\r
+/\r
+/\r
+c\r
+#\r
+\r
+-------------------------\r
+mailto:c#\r
+mailto:c#\r
+mailto:c#\r
+mailto\r
+c\r
+\r
+\r
+25\r
+False\r
+False\r
+False\r
+False\r
+Dns\r
+\r
+\r
+c\r
+#\r
+\r
+-------------------------\r
+http://c#bookmark\r
+http://c/#bookmark\r
+http://c/#bookmark\r
+http\r
+c\r
+/\r
+\r
+80\r
+False\r
+False\r
+False\r
+False\r
+Dns\r
+/\r
+/\r
+c\r
+#bookmark\r
+\r
+-------------------------\r
+urn:mono-uri-test\r
+urn:mono-uri-test\r
+urn:mono-uri-test\r
+urn\r
+\r
+mono-uri-test\r
+\r
+-1\r
+False\r
+False\r
+False\r
+False\r
+Basic\r
+mono-uri-test\r
+mono-uri-test\r
+\r
+\r
+\r
+-------------------------\r
+urn:mono-uri-test:8080\r
+urn:mono-uri-test:8080\r
+urn:mono-uri-test:8080\r
+urn\r
+\r
+mono-uri-test:8080\r
+\r
+-1\r
+False\r
+False\r
+False\r
+False\r
+Basic\r
+mono-uri-test:8080\r
+mono-uri-test:8080\r
+\r
+\r
+\r
+-------------------------\r
+urn://mono-uri-test:8080\r
+urn://mono-uri-test:8080/\r
+urn://mono-uri-test:8080/\r
+urn\r
+mono-uri-test\r
+/\r
+\r
+8080\r
+False\r
+False\r
+False\r
+False\r
+Dns\r
+/\r
+/\r
+mono-uri-test:8080\r
+\r
+\r
+-------------------------\r
+ファイル:myserver/foo.txt\r
+ファイル:myserver/foo.txt\r
+ファイル:myserver/foo.txt\r
+ファイル\r
+\r
+myserver/foo.txt\r
+\r
+-1\r
+False\r
+False\r
+False\r
+False\r
+Basic\r
+myserver/foo.txt\r
+myserver/foo.txt\r
+\r
+\r
+\r
+-------------------------\r
+ファイル://myserver/foo.txt\r
+ファイル://myserver/foo.txt\r
+ファイル://myserver/foo.txt\r
+ファイル\r
+myserver\r
+/foo.txt\r
+\r
+-1\r
+False\r
+False\r
+False\r
+False\r
+Dns\r
+/foo.txt\r
+/foo.txt\r
+myserver\r
+\r
+\r
+-------------------------\r
+辭典://cn_to_ja/\r
+辭典://cn_to_ja/\r
+辭典://cn_to_ja/\r
+辭典\r
+cn_to_ja\r
+/\r
+\r
+-1\r
+False\r
+False\r
+False\r
+False\r
+Dns\r
+/\r
+/\r
+cn_to_ja\r
+\r
+\r
+-------------------------\r
+http://web.app.com/test.cgi?value=あいうえお\r
+http://web.app.com/test.cgi?value=あいうえお\r
+http://web.app.com/test.cgi?value=%E3%81%82%E3%81%84%E3%81%86%E3%81%88%E3%81%8A\r
+http\r
+web.app.com\r
+/test.cgi\r
+?value=%E3%81%82%E3%81%84%E3%81%86%E3%81%88%E3%81%8A\r
+80\r
+False\r
+False\r
+False\r
+False\r
+Dns\r
+/test.cgi\r
+/test.cgi?value=%E3%81%82%E3%81%84%E3%81%86%E3%81%88%E3%81%8A\r
+web.app.com\r
+\r
+\r
+-------------------------\r
+辭典:cn_to_ja/ファイル\r
+辭典:cn_to_ja/ファイル\r
+辭典:cn_to_ja/%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB\r
+辭典\r
+\r
+cn_to_ja/%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB\r
+\r
+-1\r
+False\r
+False\r
+False\r
+False\r
+Basic\r
+cn_to_ja/%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB\r
+cn_to_ja/%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB\r
+\r
+\r
+\r
+-------------------------\r
+ファイル:\r
+ファイル:\r
+ファイル:\r
+ファイル\r
+\r
+\r
+\r
+-1\r
+False\r
+False\r
+False\r
+False\r
+Basic\r
+\r
+\r
+\r
+\r
+\r
+-------------------------\r
+辭典:\r
+辭典:\r
+辭典:\r
+辭典\r
+\r
+\r
+\r
+-1\r
+False\r
+False\r
+False\r
+False\r
+Basic\r
+\r
+\r
+\r
+\r
+\r
--- /dev/null
+//\r
+// uri-test-generator.cs : URI test result generator.\r
+//\r
+// Author:\r
+// Atsushi Enomoto <atushi@ximian.com>\r
+//\r
+// (C)2003 Novell inc.\r
+//\r
+// See test-uri-list.txt for usage.\r
+//\r
+using System;\r
+using System.IO;\r
+using System.Text;\r
+using NUnit.Framework;\r
+\r
+namespace MonoTests.System\r
+{\r
+ [TestFixture]\r
+ public class UriTestGenerator\r
+ {\r
+ public static void Main (string [] args)\r
+ {\r
+ StreamReader sr = new StreamReader ("test-uri-list.txt", Encoding.UTF8);\r
+ StreamWriter sw = new StreamWriter ("test-uri-props.txt", false, Encoding.UTF8);\r
+\r
+ GenerateResult (sr, sw, null);\r
+ }\r
+\r
+ public static void GenerateResult (TextReader sr, TextWriter sw, Uri baseUri)\r
+ {\r
+ while (sr.Peek () > 0) {\r
+ string uriString = sr.ReadLine ();\r
+ if (uriString.Length == 0 || uriString [0] == '#')\r
+ continue;\r
+ Uri uri = (baseUri == null) ?\r
+ new Uri (uriString) : new Uri (baseUri, uriString);\r
+\r
+ sw.WriteLine ("-------------------------");\r
+ sw.WriteLine (uriString);\r
+ sw.WriteLine (uri.ToString ());\r
+ sw.WriteLine (uri.AbsoluteUri);\r
+ sw.WriteLine (uri.Scheme);\r
+ sw.WriteLine (uri.Host);\r
+ sw.WriteLine (uri.LocalPath);\r
+ sw.WriteLine (uri.Query);\r
+ sw.WriteLine (uri.Port);\r
+ sw.WriteLine (uri.IsFile);\r
+ sw.WriteLine (uri.IsUnc);\r
+ sw.WriteLine (uri.IsLoopback);\r
+ sw.WriteLine (uri.UserEscaped);\r
+ sw.WriteLine (uri.HostNameType);\r
+ sw.WriteLine (uri.AbsolutePath);\r
+ sw.WriteLine (uri.PathAndQuery);\r
+ sw.WriteLine (uri.Authority);\r
+ sw.WriteLine (uri.Fragment);\r
+ sw.WriteLine (uri.UserInfo);\r
+ }\r
+ sr.Close ();\r
+ sw.Close ();\r
+ }\r
+\r
+ }\r
+}\r