-
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.
Merge pull request #343 from scala-native/topic/equality-virtual-disp…
…atch Fix #260
- Loading branch information
Showing
7 changed files
with
76 additions
and
34 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
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
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,23 @@ | ||
package scala | ||
|
||
object EqualitySuite extends tests.Suite { | ||
case class O(m: Int) | ||
|
||
test("case class equality") { | ||
assert(O(5) == O(5)) | ||
} | ||
|
||
test("null equals null") { | ||
assert((null: Object) == (null: Object)) | ||
} | ||
|
||
test("null does not equal object") { | ||
val obj = new Object | ||
assert((null: Object) != obj) | ||
} | ||
|
||
test("object does not equal null") { | ||
val obj = new Object | ||
assert(obj != (null: Object)) | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
unit-tests/src/main/scala/scala/scalanative/issues/_260.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,15 @@ | ||
package scala.scalanative.issues | ||
|
||
object _260 extends tests.Suite { | ||
test("https://github.com/scala-native/scala-native/issues/260") { | ||
def getStr(): String = { | ||
val bytes = Array('h'.toByte, 'o'.toByte, 'l'.toByte, 'a'.toByte) | ||
new String(bytes) | ||
} | ||
|
||
val sz = getStr() | ||
|
||
assert("hola" == sz) | ||
assert("hola".equals(sz)) | ||
} | ||
} |
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