diff options
author | Alexei Zavjalov <alexei.zavjalov@intel.com> | 2014-02-26 17:28:35 +0700 |
---|---|---|
committer | Alexei Zavjalov <alexei.zavjalov@intel.com> | 2014-02-27 00:01:00 +0700 |
commit | 4554bfdc2859712a763a12e35a4176914fc7c994 (patch) | |
tree | 6ec9fde68d61fbf5e33955a54755d3e346b38bb5 /test | |
parent | ef2cc5a9c6e508a3e8b24d04ca35f7422f27e112 (diff) | |
download | art-4554bfdc2859712a763a12e35a4176914fc7c994.zip art-4554bfdc2859712a763a12e35a4176914fc7c994.tar.gz art-4554bfdc2859712a763a12e35a4176914fc7c994.tar.bz2 |
Incorrect result of compareTo between empty and non-empty strings
Current implementation of the Strings.compareTo() handles the case when
empty string compares to non-empty string in the wrong way.
This patch adds handler for such cases.
Change-Id: I35cc2cfd5141551d6da65748c44b59e64a3f8117
Signed-off-by: Alexei Zavjalov <alexei.zavjalov@intel.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/021-string2/src/Main.java | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test/021-string2/src/Main.java b/test/021-string2/src/Main.java index 87e4baf..0239a3c 100644 --- a/test/021-string2/src/Main.java +++ b/test/021-string2/src/Main.java @@ -36,6 +36,10 @@ public class Main { Assert.assertTrue(test1.compareTo(test2) > 0); Assert.assertTrue(test2.compareTo(test1) < 0); + Assert.assertEquals("".compareTo(""), 0); + Assert.assertTrue(test.compareTo("") > 0); + Assert.assertTrue("".compareTo(test) < 0); + /* compare string with a nonzero offset, in left/right side */ Assert.assertEquals(test.compareTo(sub), 0); Assert.assertEquals(sub.compareTo(test), 0); |