{"action":"created","comment":{"url":"https://api.github.com/repos/scala-js/scala-js/pulls/comments/46558817","id":46558817,"diff_hunk":"@@ -0,0 +1,155 @@\n+/*                     __                                               *\\\n+**     ________ ___   / /  ___      __ ____  Scala.js Test Suite        **\n+**    / __/ __// _ | / /  / _ | __ / // __/  (c) 2013, LAMP/EPFL        **\n+**  __\\ \\/ /__/ __ |/ /__/ __ |/_// /_\\ \\    http://scala-js.org/       **\n+** /____/\\___/_/ |_/____/_/ | |__/ /____/                               **\n+**                          |/____/                                     **\n+\\*                                                                      */\n+package org.scalajs.testsuite.javalib.lang\n+\n+import language.implicitConversions\n+\n+import org.junit.Test\n+import org.junit.Assert._\n+\n+import org.scalajs.testsuite.utils.Platform.executingInJVM\n+\n+class SystemTest {\n+\n+  @Test def setIn(): Unit = {\n+    val savedIn = System.in\n+    try {\n+      val testIn = new java.io.ByteArrayInputStream(Array[Byte]())\n+      System.setIn(testIn)\n+      assertTrue(System.in eq testIn)\n+    } finally {\n+      System.setIn(savedIn)\n+    }\n+  }\n+\n+  @Test def setOut(): Unit = {\n+    val savedOut = System.out\n+    try {\n+      val testOut = new java.io.PrintStream(new java.io.ByteArrayOutputStream)\n+      System.setOut(testOut)\n+      assertTrue(System.out eq testOut)\n+    } finally {\n+      System.setOut(savedOut)\n+    }\n+  }\n+\n+  @Test def setErr(): Unit = {\n+    val savedErr = System.err\n+    try {\n+      val testErr = new java.io.PrintStream(new java.io.ByteArrayOutputStream)\n+      System.setErr(testErr)\n+      assertTrue(System.err eq testErr)\n+    } finally {\n+      System.setErr(savedErr)\n+    }\n+  }\n+\n+  @Test def should_respond_to_arraycopy(): Unit = {\n+    val object0 = Array[Any](\"[\", \"b\", \"c\", \"d\", \"e\", \"f\", \"]\")\n+    val object1 = Array[Any](() => true, 1, \"2\", '3', 4.0, true, object0)\n+\n+    System.arraycopy(object1, 1, object0, 1, 5)\n+    if (executingInJVM) {\n+      assertEquals(\"[1234.0true]\", object0.mkString)\n+    } else {\n+      assertEquals(\"[1234true]\", object0.mkString)\n+    }\n+\n+    val string0 = Array(\"a\", \"b\", \"c\", \"d\", \"e\", \"f\")\n+    val string1 = Array(\"1\", \"2\", \"3\", \"4\")\n+\n+    System.arraycopy(string1, 0, string0, 3, 3)\n+    assertEquals(\"abc123\", string0.mkString)\n+\n+    val ab01Chars = Array(\"ab\".toCharArray, \"01\".toCharArray)\n+    val chars = new Array[Array[Char]](32)\n+    System.arraycopy(ab01Chars, 0, chars, 0, 2)\n+    for (i <- Seq(0, 2, 4, 8, 16)) {\n+      System.arraycopy(chars, i / 4, chars, i, i)\n+    }\n+\n+    assertEquals(12, chars.filter(_ == null).length)\n+    assertEquals(\"ab01ab0101ab01ab0101ab0101ab01ab0101ab01\",\n+      chars.filter(_ != null).map(_.mkString).mkString)\n+\n+  }\n+\n+  @Test def should_respond_to_arraycopy_with_range_overlaps_for_the_same_array(): Unit = {\n+    val array = new Array[Int](10)\n+\n+    for (i <- 1 to 6) {\n+      array(i) = i\n+    }\n+\n+    assertArrayEquals(Array(0, 1, 2, 3, 4, 5, 6, 0, 0, 0), array)\n+    System.arraycopy(array, 0, array, 3, 7)\n+    assertArrayEquals(Array(0, 1, 2, 0, 1, 2, 3, 4, 5, 6), array)\n+\n+    System.arraycopy(array, 0, array, 1, 0)\n+    assertArrayEquals(Array(0, 1, 2, 0, 1, 2, 3, 4, 5, 6), array)\n+\n+    System.arraycopy(array, 0, array, 1, 9)\n+    assertArrayEquals(Array(0, 0, 1, 2, 0, 1, 2, 3, 4, 5), array)\n+\n+    System.arraycopy(array, 1, array, 0, 9)\n+    assertArrayEquals(Array(0, 1, 2, 0, 1, 2, 3, 4, 5, 5), array)\n+\n+    System.arraycopy(array, 0, array, 0, 10)\n+    assertArrayEquals(Array(0, 1, 2, 0, 1, 2, 3, 4, 5, 5), array)\n+\n+    val reversed = array.reverse\n+    System.arraycopy(reversed, 5, array, 5, 5)\n+    assertArrayEquals(Array(0, 1, 2, 0, 1, 1, 0, 2, 1, 0), array)\n+  }\n+\n+  @Test def should_provide_identityHashCode(): Unit = {\n+    /* This test is more restrictive than the spec, but we know our\n+     * implementation will always pass the test.","path":"test-suite/shared/src/test/scala/org/scalajs/testsuite/javalib/lang/SystemTest.scala","position":112,"original_position":112,"commit_id":"55ebf91407a4904d046ca83a491fa895cb373c13","original_commit_id":"55ebf91407a4904d046ca83a491fa895cb373c13","user":{"login":"sjrd","id":535934,"avatar_url":"https://avatars.githubusercontent.com/u/535934?v=3","gravatar_id":"","url":"https://api.github.com/users/sjrd","html_url":"https://github.com/sjrd","followers_url":"https://api.github.com/users/sjrd/followers","following_url":"https://api.github.com/users/sjrd/following{/other_user}","gists_url":"https://api.github.com/users/sjrd/gists{/gist_id}","starred_url":"https://api.github.com/users/sjrd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjrd/subscriptions","organizations_url":"https://api.github.com/users/sjrd/orgs","repos_url":"https://api.github.com/users/sjrd/repos","events_url":"https://api.github.com/users/sjrd/events{/privacy}","received_events_url":"https://api.github.com/users/sjrd/received_events","type":"User","site_admin":false},"body":"This comment does not apply to the JVM.","created_at":"2015-12-03T14:44:23Z","updated_at":"2015-12-03T14:44:23Z","html_url":"https://github.com/scala-js/scala-js/pull/2083#discussion_r46558817","pull_request_url":"https://api.github.com/repos/scala-js/scala-js/pulls/2083","_links":{"self":{"href":"https://api.github.com/repos/scala-js/scala-js/pulls/comments/46558817"},"html":{"href":"https://github.com/scala-js/scala-js/pull/2083#discussion_r46558817"},"pull_request":{"href":"https://api.github.com/repos/scala-js/scala-js/pulls/2083"}}},"pull_request":{"url":"https://api.github.com/repos/scala-js/scala-js/pulls/2083","id":52408561,"html_url":"https://github.com/scala-js/scala-js/pull/2083","diff_url":"https://github.com/scala-js/scala-js/pull/2083.diff","patch_url":"https://github.com/scala-js/scala-js/pull/2083.patch","issue_url":"https://api.github.com/repos/scala-js/scala-js/issues/2083","number":2083,"state":"open","locked":false,"title":"Port and cross-compile tests for java.lang.","user":{"login":"nicolasstucki","id":3648029,"avatar_url":"https://avatars.githubusercontent.com/u/3648029?v=3","gravatar_id":"","url":"https://api.github.com/users/nicolasstucki","html_url":"https://github.com/nicolasstucki","followers_url":"https://api.github.com/users/nicolasstucki/followers","following_url":"https://api.github.com/users/nicolasstucki/following{/other_user}","gists_url":"https://api.github.com/users/nicolasstucki/gists{/gist_id}","starred_url":"https://api.github.com/users/nicolasstucki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicolasstucki/subscriptions","organizations_url":"https://api.github.com/users/nicolasstucki/orgs","repos_url":"https://api.github.com/users/nicolasstucki/repos","events_url":"https://api.github.com/users/nicolasstucki/events{/privacy}","received_events_url":"https://api.github.com/users/nicolasstucki/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-12-02T15:18:17Z","updated_at":"2015-12-03T14:44:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8215575a00432d8c649752304d8df1e099d28a04","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/scala-js/scala-js/pulls/2083/commits","review_comments_url":"https://api.github.com/repos/scala-js/scala-js/pulls/2083/comments","review_comment_url":"https://api.github.com/repos/scala-js/scala-js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scala-js/scala-js/issues/2083/comments","statuses_url":"https://api.github.com/repos/scala-js/scala-js/statuses/55ebf91407a4904d046ca83a491fa895cb373c13","head":{"label":"nicolasstucki:port-tests-java.lang","ref":"port-tests-java.lang","sha":"55ebf91407a4904d046ca83a491fa895cb373c13","user":{"login":"nicolasstucki","id":3648029,"avatar_url":"https://avatars.githubusercontent.com/u/3648029?v=3","gravatar_id":"","url":"https://api.github.com/users/nicolasstucki","html_url":"https://github.com/nicolasstucki","followers_url":"https://api.github.com/users/nicolasstucki/followers","following_url":"https://api.github.com/users/nicolasstucki/following{/other_user}","gists_url":"https://api.github.com/users/nicolasstucki/gists{/gist_id}","starred_url":"https://api.github.com/users/nicolasstucki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicolasstucki/subscriptions","organizations_url":"https://api.github.com/users/nicolasstucki/orgs","repos_url":"https://api.github.com/users/nicolasstucki/repos","events_url":"https://api.github.com/users/nicolasstucki/events{/privacy}","received_events_url":"https://api.github.com/users/nicolasstucki/received_events","type":"User","site_admin":false},"repo":{"id":35167756,"name":"scala-js","full_name":"nicolasstucki/scala-js","owner":{"login":"nicolasstucki","id":3648029,"avatar_url":"https://avatars.githubusercontent.com/u/3648029?v=3","gravatar_id":"","url":"https://api.github.com/users/nicolasstucki","html_url":"https://github.com/nicolasstucki","followers_url":"https://api.github.com/users/nicolasstucki/followers","following_url":"https://api.github.com/users/nicolasstucki/following{/other_user}","gists_url":"https://api.github.com/users/nicolasstucki/gists{/gist_id}","starred_url":"https://api.github.com/users/nicolasstucki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicolasstucki/subscriptions","organizations_url":"https://api.github.com/users/nicolasstucki/orgs","repos_url":"https://api.github.com/users/nicolasstucki/repos","events_url":"https://api.github.com/users/nicolasstucki/events{/privacy}","received_events_url":"https://api.github.com/users/nicolasstucki/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nicolasstucki/scala-js","description":"Scala.js, the Scala to JavaScript compiler","fork":true,"url":"https://api.github.com/repos/nicolasstucki/scala-js","forks_url":"https://api.github.com/repos/nicolasstucki/scala-js/forks","keys_url":"https://api.github.com/repos/nicolasstucki/scala-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nicolasstucki/scala-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nicolasstucki/scala-js/teams","hooks_url":"https://api.github.com/repos/nicolasstucki/scala-js/hooks","issue_events_url":"https://api.github.com/repos/nicolasstucki/scala-js/issues/events{/number}","events_url":"https://api.github.com/repos/nicolasstucki/scala-js/events","assignees_url":"https://api.github.com/repos/nicolasstucki/scala-js/assignees{/user}","branches_url":"https://api.github.com/repos/nicolasstucki/scala-js/branches{/branch}","tags_url":"https://api.github.com/repos/nicolasstucki/scala-js/tags","blobs_url":"https://api.github.com/repos/nicolasstucki/scala-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nicolasstucki/scala-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nicolasstucki/scala-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/nicolasstucki/scala-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nicolasstucki/scala-js/statuses/{sha}","languages_url":"https://api.github.com/repos/nicolasstucki/scala-js/languages","stargazers_url":"https://api.github.com/repos/nicolasstucki/scala-js/stargazers","contributors_url":"https://api.github.com/repos/nicolasstucki/scala-js/contributors","subscribers_url":"https://api.github.com/repos/nicolasstucki/scala-js/subscribers","subscription_url":"https://api.github.com/repos/nicolasstucki/scala-js/subscription","commits_url":"https://api.github.com/repos/nicolasstucki/scala-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/nicolasstucki/scala-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/nicolasstucki/scala-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/nicolasstucki/scala-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/nicolasstucki/scala-js/contents/{+path}","compare_url":"https://api.github.com/repos/nicolasstucki/scala-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nicolasstucki/scala-js/merges","archive_url":"https://api.github.com/repos/nicolasstucki/scala-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nicolasstucki/scala-js/downloads","issues_url":"https://api.github.com/repos/nicolasstucki/scala-js/issues{/number}","pulls_url":"https://api.github.com/repos/nicolasstucki/scala-js/pulls{/number}","milestones_url":"https://api.github.com/repos/nicolasstucki/scala-js/milestones{/number}","notifications_url":"https://api.github.com/repos/nicolasstucki/scala-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nicolasstucki/scala-js/labels{/name}","releases_url":"https://api.github.com/repos/nicolasstucki/scala-js/releases{/id}","created_at":"2015-05-06T15:41:56Z","updated_at":"2015-05-06T15:41:58Z","pushed_at":"2015-12-03T14:37:52Z","git_url":"git://github.com/nicolasstucki/scala-js.git","ssh_url":"git@github.com:nicolasstucki/scala-js.git","clone_url":"https://github.com/nicolasstucki/scala-js.git","svn_url":"https://github.com/nicolasstucki/scala-js","homepage":"http://www.scala-js.org/","size":10162,"stargazers_count":0,"watchers_count":0,"language":"Scala","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":0,"default_branch":"master"}},"base":{"label":"scala-js:master","ref":"master","sha":"b33d4754a80bd2116a3c5f3baeca7601e24d3638","user":{"login":"scala-js","id":6039724,"avatar_url":"https://avatars.githubusercontent.com/u/6039724?v=3","gravatar_id":"","url":"https://api.github.com/users/scala-js","html_url":"https://github.com/scala-js","followers_url":"https://api.github.com/users/scala-js/followers","following_url":"https://api.github.com/users/scala-js/following{/other_user}","gists_url":"https://api.github.com/users/scala-js/gists{/gist_id}","starred_url":"https://api.github.com/users/scala-js/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scala-js/subscriptions","organizations_url":"https://api.github.com/users/scala-js/orgs","repos_url":"https://api.github.com/users/scala-js/repos","events_url":"https://api.github.com/users/scala-js/events{/privacy}","received_events_url":"https://api.github.com/users/scala-js/received_events","type":"Organization","site_admin":false},"repo":{"id":8272315,"name":"scala-js","full_name":"scala-js/scala-js","owner":{"login":"scala-js","id":6039724,"avatar_url":"https://avatars.githubusercontent.com/u/6039724?v=3","gravatar_id":"","url":"https://api.github.com/users/scala-js","html_url":"https://github.com/scala-js","followers_url":"https://api.github.com/users/scala-js/followers","following_url":"https://api.github.com/users/scala-js/following{/other_user}","gists_url":"https://api.github.com/users/scala-js/gists{/gist_id}","starred_url":"https://api.github.com/users/scala-js/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scala-js/subscriptions","organizations_url":"https://api.github.com/users/scala-js/orgs","repos_url":"https://api.github.com/users/scala-js/repos","events_url":"https://api.github.com/users/scala-js/events{/privacy}","received_events_url":"https://api.github.com/users/scala-js/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scala-js/scala-js","description":"Scala.js, the Scala to JavaScript compiler","fork":false,"url":"https://api.github.com/repos/scala-js/scala-js","forks_url":"https://api.github.com/repos/scala-js/scala-js/forks","keys_url":"https://api.github.com/repos/scala-js/scala-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scala-js/scala-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scala-js/scala-js/teams","hooks_url":"https://api.github.com/repos/scala-js/scala-js/hooks","issue_events_url":"https://api.github.com/repos/scala-js/scala-js/issues/events{/number}","events_url":"https://api.github.com/repos/scala-js/scala-js/events","assignees_url":"https://api.github.com/repos/scala-js/scala-js/assignees{/user}","branches_url":"https://api.github.com/repos/scala-js/scala-js/branches{/branch}","tags_url":"https://api.github.com/repos/scala-js/scala-js/tags","blobs_url":"https://api.github.com/repos/scala-js/scala-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scala-js/scala-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scala-js/scala-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/scala-js/scala-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scala-js/scala-js/statuses/{sha}","languages_url":"https://api.github.com/repos/scala-js/scala-js/languages","stargazers_url":"https://api.github.com/repos/scala-js/scala-js/stargazers","contributors_url":"https://api.github.com/repos/scala-js/scala-js/contributors","subscribers_url":"https://api.github.com/repos/scala-js/scala-js/subscribers","subscription_url":"https://api.github.com/repos/scala-js/scala-js/subscription","commits_url":"https://api.github.com/repos/scala-js/scala-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/scala-js/scala-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/scala-js/scala-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/scala-js/scala-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/scala-js/scala-js/contents/{+path}","compare_url":"https://api.github.com/repos/scala-js/scala-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scala-js/scala-js/merges","archive_url":"https://api.github.com/repos/scala-js/scala-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scala-js/scala-js/downloads","issues_url":"https://api.github.com/repos/scala-js/scala-js/issues{/number}","pulls_url":"https://api.github.com/repos/scala-js/scala-js/pulls{/number}","milestones_url":"https://api.github.com/repos/scala-js/scala-js/milestones{/number}","notifications_url":"https://api.github.com/repos/scala-js/scala-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scala-js/scala-js/labels{/name}","releases_url":"https://api.github.com/repos/scala-js/scala-js/releases{/id}","created_at":"2013-02-18T16:33:55Z","updated_at":"2015-12-03T11:47:07Z","pushed_at":"2015-12-03T14:37:53Z","git_url":"git://github.com/scala-js/scala-js.git","ssh_url":"git@github.com:scala-js/scala-js.git","clone_url":"https://github.com/scala-js/scala-js.git","svn_url":"https://github.com/scala-js/scala-js","homepage":"http://www.scala-js.org/","size":11749,"stargazers_count":2001,"watchers_count":2001,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":178,"mirror_url":null,"open_issues_count":111,"forks":178,"open_issues":111,"watchers":2001,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scala-js/scala-js/pulls/2083"},"html":{"href":"https://github.com/scala-js/scala-js/pull/2083"},"issue":{"href":"https://api.github.com/repos/scala-js/scala-js/issues/2083"},"comments":{"href":"https://api.github.com/repos/scala-js/scala-js/issues/2083/comments"},"review_comments":{"href":"https://api.github.com/repos/scala-js/scala-js/pulls/2083/comments"},"review_comment":{"href":"https://api.github.com/repos/scala-js/scala-js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scala-js/scala-js/pulls/2083/commits"},"statuses":{"href":"https://api.github.com/repos/scala-js/scala-js/statuses/55ebf91407a4904d046ca83a491fa895cb373c13"}}}}