{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/corefx/pulls/comments/29545370","id":29545370,"diff_hunk":"@@ -0,0 +1,515 @@\n+// Copyright (c) Microsoft. All rights reserved.\n+// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n+\n+using System;\n+using Xunit;\n+\n+// TODO: Remove these extension methods when the actual methods are available on String in System.Runtime.dll\n+internal static class TemporaryStringSplitExtensions\n+{\n+    public static string[] Split(this string value, char separator)\n+    {\n+        return value.Split(new[] { separator });\n+    }\n+\n+    public static string[] Split(this string value, char separator, StringSplitOptions options)\n+    {\n+        return value.Split(new[] { separator }, options);\n+    }\n+\n+    public static string[] Split(this string value, char separator, int count, StringSplitOptions options)\n+    {\n+        return value.Split(new[] { separator }, count, options);\n+    }\n+\n+    public static string[] Split(this string value, string separator)\n+    {\n+        return value.Split(new[] { separator }, StringSplitOptions.None);\n+    }\n+\n+    public static string[] Split(this string value, string separator, StringSplitOptions options)\n+    {\n+        return value.Split(new[] { separator }, options);\n+    }\n+\n+    public static string[] Split(this string value, string separator, int count, StringSplitOptions options)\n+    {\n+        return value.Split(new[] { separator }, count, options);\n+    }\n+}\n+\n+public static class StringSplitTests\n+{\n+    [Fact]\n+    public static void TestSplitInvalidCount()\n+    {\n+        const string value = \"a,b\";\n+        const int count = -1;\n+        const StringSplitOptions options = StringSplitOptions.None;\n+\n+        Assert.Throws<ArgumentOutOfRangeException>(() => value.Split(',', count, options));\n+        Assert.Throws<ArgumentOutOfRangeException>(() => value.Split(new[] { ',' }, count));\n+        Assert.Throws<ArgumentOutOfRangeException>(() => value.Split(new[] { ',' }, count, options));\n+        Assert.Throws<ArgumentOutOfRangeException>(() => value.Split(\",\", count, options));\n+        Assert.Throws<ArgumentOutOfRangeException>(() => value.Split(new[] { \",\" }, count, options));\n+    }\n+\n+    [Fact]\n+    public static void TestSplitInvalidOptions()\n+    {\n+        const string value = \"a,b\";\n+        const int count = int.MaxValue;\n+        const StringSplitOptions optionsTooLow = StringSplitOptions.None - 1;\n+        const StringSplitOptions optionsTooHigh = StringSplitOptions.RemoveEmptyEntries + 1;\n+\n+        Assert.Throws<ArgumentException>(() => value.Split(',', optionsTooLow));\n+        Assert.Throws<ArgumentException>(() => value.Split(',', optionsTooHigh));\n+        Assert.Throws<ArgumentException>(() => value.Split(',', count, optionsTooLow));\n+        Assert.Throws<ArgumentException>(() => value.Split(',', count, optionsTooHigh));\n+        Assert.Throws<ArgumentException>(() => value.Split(new[] { ',' }, optionsTooLow));\n+        Assert.Throws<ArgumentException>(() => value.Split(new[] { ',' }, optionsTooHigh));\n+        Assert.Throws<ArgumentException>(() => value.Split(new[] { ',' }, count, optionsTooLow));\n+        Assert.Throws<ArgumentException>(() => value.Split(new[] { ',' }, count, optionsTooHigh));\n+        Assert.Throws<ArgumentException>(() => value.Split(\",\", optionsTooLow));\n+        Assert.Throws<ArgumentException>(() => value.Split(\",\", optionsTooHigh));\n+        Assert.Throws<ArgumentException>(() => value.Split(\",\", count, optionsTooLow));\n+        Assert.Throws<ArgumentException>(() => value.Split(\",\", count, optionsTooHigh));\n+        Assert.Throws<ArgumentException>(() => value.Split(new[] { \",\" }, optionsTooLow));\n+        Assert.Throws<ArgumentException>(() => value.Split(new[] { \",\" }, optionsTooHigh));\n+        Assert.Throws<ArgumentException>(() => value.Split(new[] { \",\" }, count, optionsTooLow));\n+        Assert.Throws<ArgumentException>(() => value.Split(new[] { \",\" }, count, optionsTooHigh));\n+    }\n+\n+    [Fact]\n+    public static void TestSplitZeroCountEmptyResult()\n+    {\n+        const string value = \"a,b\";\n+        const int count = 0;\n+        const StringSplitOptions options = StringSplitOptions.None;\n+\n+        string[] expected = new string[0];","path":"src/System.Runtime/tests/System/String.Split.cs","position":90,"original_position":90,"commit_id":"d9f4fd1c31178324731f08fdc3dd714a79fd51b8","original_commit_id":"d9f4fd1c31178324731f08fdc3dd714a79fd51b8","user":{"login":"hpshelton","id":156465,"avatar_url":"https://avatars.githubusercontent.com/u/156465?v=3","gravatar_id":"","url":"https://api.github.com/users/hpshelton","html_url":"https://github.com/hpshelton","followers_url":"https://api.github.com/users/hpshelton/followers","following_url":"https://api.github.com/users/hpshelton/following{/other_user}","gists_url":"https://api.github.com/users/hpshelton/gists{/gist_id}","starred_url":"https://api.github.com/users/hpshelton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hpshelton/subscriptions","organizations_url":"https://api.github.com/users/hpshelton/orgs","repos_url":"https://api.github.com/users/hpshelton/repos","events_url":"https://api.github.com/users/hpshelton/events{/privacy}","received_events_url":"https://api.github.com/users/hpshelton/received_events","type":"User","site_admin":false},"body":"See https://github.com/dotnet/corefx/commit/16db3ae693a36f9f8e898c909464b5f6e35b29d1 where @stephentoub  is replacing `new T[0]` usages with `Array.Empty<T>()`. That seems to be the preferred style going forward to reduce allocations.","created_at":"2015-05-02T05:35:37Z","updated_at":"2015-05-02T05:35:37Z","html_url":"https://github.com/dotnet/corefx/pull/1600#discussion_r29545370","pull_request_url":"https://api.github.com/repos/dotnet/corefx/pulls/1600","_links":{"self":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/comments/29545370"},"html":{"href":"https://github.com/dotnet/corefx/pull/1600#discussion_r29545370"},"pull_request":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/1600"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/corefx/pulls/1600","id":34512155,"html_url":"https://github.com/dotnet/corefx/pull/1600","diff_url":"https://github.com/dotnet/corefx/pull/1600.diff","patch_url":"https://github.com/dotnet/corefx/pull/1600.patch","issue_url":"https://api.github.com/repos/dotnet/corefx/issues/1600","number":1600,"state":"open","locked":false,"title":"Add more String.Split tests","user":{"login":"justinvp","id":710598,"avatar_url":"https://avatars.githubusercontent.com/u/710598?v=3","gravatar_id":"","url":"https://api.github.com/users/justinvp","html_url":"https://github.com/justinvp","followers_url":"https://api.github.com/users/justinvp/followers","following_url":"https://api.github.com/users/justinvp/following{/other_user}","gists_url":"https://api.github.com/users/justinvp/gists{/gist_id}","starred_url":"https://api.github.com/users/justinvp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justinvp/subscriptions","organizations_url":"https://api.github.com/users/justinvp/orgs","repos_url":"https://api.github.com/users/justinvp/repos","events_url":"https://api.github.com/users/justinvp/events{/privacy}","received_events_url":"https://api.github.com/users/justinvp/received_events","type":"User","site_admin":false},"body":"Round out `String.Split` tests in anticipation of #1513.\r\n\r\nIt's not exhaustive. There are some redundant `[InlineData(...)]` cases for counts 2-4 that could probably be removed, but it doesn't really hurt to keep them (these tests are fast) as they do still verify the expected result for those counts.\r\n\r\n/cc @ellismg","created_at":"2015-04-30T23:55:00Z","updated_at":"2015-05-02T05:35:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"802e390b2b176eb1f77fef3210317c6f50e8f59f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/corefx/pulls/1600/commits","review_comments_url":"https://api.github.com/repos/dotnet/corefx/pulls/1600/comments","review_comment_url":"https://api.github.com/repos/dotnet/corefx/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/corefx/issues/1600/comments","statuses_url":"https://api.github.com/repos/dotnet/corefx/statuses/d9f4fd1c31178324731f08fdc3dd714a79fd51b8","head":{"label":"justinvp:stringsplittests","ref":"stringsplittests","sha":"d9f4fd1c31178324731f08fdc3dd714a79fd51b8","user":{"login":"justinvp","id":710598,"avatar_url":"https://avatars.githubusercontent.com/u/710598?v=3","gravatar_id":"","url":"https://api.github.com/users/justinvp","html_url":"https://github.com/justinvp","followers_url":"https://api.github.com/users/justinvp/followers","following_url":"https://api.github.com/users/justinvp/following{/other_user}","gists_url":"https://api.github.com/users/justinvp/gists{/gist_id}","starred_url":"https://api.github.com/users/justinvp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justinvp/subscriptions","organizations_url":"https://api.github.com/users/justinvp/orgs","repos_url":"https://api.github.com/users/justinvp/repos","events_url":"https://api.github.com/users/justinvp/events{/privacy}","received_events_url":"https://api.github.com/users/justinvp/received_events","type":"User","site_admin":false},"repo":{"id":28229041,"name":"corefx","full_name":"justinvp/corefx","owner":{"login":"justinvp","id":710598,"avatar_url":"https://avatars.githubusercontent.com/u/710598?v=3","gravatar_id":"","url":"https://api.github.com/users/justinvp","html_url":"https://github.com/justinvp","followers_url":"https://api.github.com/users/justinvp/followers","following_url":"https://api.github.com/users/justinvp/following{/other_user}","gists_url":"https://api.github.com/users/justinvp/gists{/gist_id}","starred_url":"https://api.github.com/users/justinvp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justinvp/subscriptions","organizations_url":"https://api.github.com/users/justinvp/orgs","repos_url":"https://api.github.com/users/justinvp/repos","events_url":"https://api.github.com/users/justinvp/events{/privacy}","received_events_url":"https://api.github.com/users/justinvp/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/justinvp/corefx","description":"This repository contains the foundational libraries that make up the .NET Core development stack.","fork":true,"url":"https://api.github.com/repos/justinvp/corefx","forks_url":"https://api.github.com/repos/justinvp/corefx/forks","keys_url":"https://api.github.com/repos/justinvp/corefx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/justinvp/corefx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/justinvp/corefx/teams","hooks_url":"https://api.github.com/repos/justinvp/corefx/hooks","issue_events_url":"https://api.github.com/repos/justinvp/corefx/issues/events{/number}","events_url":"https://api.github.com/repos/justinvp/corefx/events","assignees_url":"https://api.github.com/repos/justinvp/corefx/assignees{/user}","branches_url":"https://api.github.com/repos/justinvp/corefx/branches{/branch}","tags_url":"https://api.github.com/repos/justinvp/corefx/tags","blobs_url":"https://api.github.com/repos/justinvp/corefx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/justinvp/corefx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/justinvp/corefx/git/refs{/sha}","trees_url":"https://api.github.com/repos/justinvp/corefx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/justinvp/corefx/statuses/{sha}","languages_url":"https://api.github.com/repos/justinvp/corefx/languages","stargazers_url":"https://api.github.com/repos/justinvp/corefx/stargazers","contributors_url":"https://api.github.com/repos/justinvp/corefx/contributors","subscribers_url":"https://api.github.com/repos/justinvp/corefx/subscribers","subscription_url":"https://api.github.com/repos/justinvp/corefx/subscription","commits_url":"https://api.github.com/repos/justinvp/corefx/commits{/sha}","git_commits_url":"https://api.github.com/repos/justinvp/corefx/git/commits{/sha}","comments_url":"https://api.github.com/repos/justinvp/corefx/comments{/number}","issue_comment_url":"https://api.github.com/repos/justinvp/corefx/issues/comments{/number}","contents_url":"https://api.github.com/repos/justinvp/corefx/contents/{+path}","compare_url":"https://api.github.com/repos/justinvp/corefx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/justinvp/corefx/merges","archive_url":"https://api.github.com/repos/justinvp/corefx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/justinvp/corefx/downloads","issues_url":"https://api.github.com/repos/justinvp/corefx/issues{/number}","pulls_url":"https://api.github.com/repos/justinvp/corefx/pulls{/number}","milestones_url":"https://api.github.com/repos/justinvp/corefx/milestones{/number}","notifications_url":"https://api.github.com/repos/justinvp/corefx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/justinvp/corefx/labels{/name}","releases_url":"https://api.github.com/repos/justinvp/corefx/releases{/id}","created_at":"2014-12-19T12:43:43Z","updated_at":"2015-04-30T22:29:39Z","pushed_at":"2015-05-01T05:03:49Z","git_url":"git://github.com/justinvp/corefx.git","ssh_url":"git@github.com:justinvp/corefx.git","clone_url":"https://github.com/justinvp/corefx.git","svn_url":"https://github.com/justinvp/corefx","homepage":"","size":18185,"stargazers_count":1,"watchers_count":1,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"cd67f03507c7cadbc0da6cb6a2cdc4340849c875","user":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":26295345,"name":"corefx","full_name":"dotnet/corefx","owner":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dotnet/corefx","description":"This repo contains the .NET Core foundational libraries, called CoreFX. It includes classes for collections, file systems, console, XML, async and many others.","fork":false,"url":"https://api.github.com/repos/dotnet/corefx","forks_url":"https://api.github.com/repos/dotnet/corefx/forks","keys_url":"https://api.github.com/repos/dotnet/corefx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/corefx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/corefx/teams","hooks_url":"https://api.github.com/repos/dotnet/corefx/hooks","issue_events_url":"https://api.github.com/repos/dotnet/corefx/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/corefx/events","assignees_url":"https://api.github.com/repos/dotnet/corefx/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/corefx/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/corefx/tags","blobs_url":"https://api.github.com/repos/dotnet/corefx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/corefx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/corefx/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/corefx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/corefx/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/corefx/languages","stargazers_url":"https://api.github.com/repos/dotnet/corefx/stargazers","contributors_url":"https://api.github.com/repos/dotnet/corefx/contributors","subscribers_url":"https://api.github.com/repos/dotnet/corefx/subscribers","subscription_url":"https://api.github.com/repos/dotnet/corefx/subscription","commits_url":"https://api.github.com/repos/dotnet/corefx/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/corefx/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/corefx/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/corefx/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/corefx/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/corefx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/corefx/merges","archive_url":"https://api.github.com/repos/dotnet/corefx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/corefx/downloads","issues_url":"https://api.github.com/repos/dotnet/corefx/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/corefx/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/corefx/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/corefx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/corefx/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/corefx/releases{/id}","created_at":"2014-11-06T23:42:48Z","updated_at":"2015-05-02T05:22:16Z","pushed_at":"2015-05-02T04:59:50Z","git_url":"git://github.com/dotnet/corefx.git","ssh_url":"git@github.com:dotnet/corefx.git","clone_url":"https://github.com/dotnet/corefx.git","svn_url":"https://github.com/dotnet/corefx","homepage":"","size":40780,"stargazers_count":7662,"watchers_count":7662,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1516,"mirror_url":null,"open_issues_count":362,"forks":1516,"open_issues":362,"watchers":7662,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/1600"},"html":{"href":"https://github.com/dotnet/corefx/pull/1600"},"issue":{"href":"https://api.github.com/repos/dotnet/corefx/issues/1600"},"comments":{"href":"https://api.github.com/repos/dotnet/corefx/issues/1600/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/1600/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/1600/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/corefx/statuses/d9f4fd1c31178324731f08fdc3dd714a79fd51b8"}}}}