bind/java: ensure there is enough capacity for writing seq

The new testLongString triggers the bug without this change.

Fixes golang/go#9251.

Change-Id: I463e2897b5b08f53801f151c7311d591546c0719
Reviewed-on: https://go-review.googlesource.com/1373
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
This commit is contained in:
David Crawshaw
2014-12-11 17:53:23 +00:00
parent 96c0ef1480
commit 6cf9d880ce
5 changed files with 62 additions and 11 deletions
+22
View File
@@ -16,6 +16,28 @@ public class SeqTest extends TestCase {
assertEquals("Unexpected arithmetic failure", 7, res);
}
public void testShortString() {
String want = "a short string";
String got = Testpkg.StrDup(want);
assertEquals("Strings should match", want, got);
}
public void testLongString() {
StringBuilder b = new StringBuilder();
for (int i = 0; i < 128*1024; i++) {
b.append("0123456789");
}
String want = b.toString();
String got = Testpkg.StrDup(want);
assertEquals("Strings should match", want, got);
}
public void testUnicode() {
String want = "Hello, 世界";
String got = Testpkg.StrDup(want);
assertEquals("Strings should match", want, got);
}
public void testGoRefGC() {
Testpkg.S s = Testpkg.New();
runGC();