-
Notifications
You must be signed in to change notification settings - Fork 362
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provides initial implementation for java.lang.Class::getComponentType.
- Loading branch information
Showing
3 changed files
with
44 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package java.lang | ||
|
||
object ClassSuite extends tests.Suite { | ||
test("getComponentType") { | ||
assert(Array(false).getClass.getComponentType == classOf[scala.Boolean]) | ||
assert(Array('0').getClass.getComponentType == classOf[scala.Char]) | ||
assert(Array(0.toByte).getClass.getComponentType == classOf[scala.Byte]) | ||
assert(Array(0.toShort).getClass.getComponentType == classOf[scala.Short]) | ||
assert(Array(0).getClass.getComponentType == classOf[scala.Int]) | ||
assert(Array(0L).getClass.getComponentType == classOf[scala.Long]) | ||
assert(Array(0F).getClass.getComponentType == classOf[scala.Float]) | ||
assert(Array(0D).getClass.getComponentType == classOf[scala.Double]) | ||
assert( | ||
Array(new java.lang.Object).getClass.getComponentType == classOf[ | ||
java.lang.Object]) | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
unit-tests/src/main/scala/scala/scalanative/issues/_253Suite.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package scala.scalanative.issues | ||
|
||
object _253Suite extends tests.Suite { | ||
test("#253") { | ||
class Cell(val value: Int) | ||
|
||
val arr = Array(new Cell(1), new Cell(2)) | ||
val reverse = arr.reverse | ||
|
||
assert(reverse(0).value == 2) | ||
assert(reverse(1).value == 1) | ||
} | ||
} |