Author: odeakin
Date: Tue Feb 12 02:32:39 2008
New Revision: 620745
URL: http://svn.apache.org/viewvc?rev=620745&view=rev
Log:
Regression test for HARMONY-4774 ([classlib][luni] java.util.Scanner.nextLine() has a problem
on newline)
Modified:
harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/ScannerTest.java
Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/ScannerTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/ScannerTest.java?rev=620745&r1=620744&r2=620745&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/ScannerTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/ScannerTest.java
Tue Feb 12 02:32:39 2008
@@ -5585,6 +5585,22 @@
s = new Scanner("test\n ");
result = s.nextLine();
assertEquals("test", result);
+
+ // Regression test for Harmony-4774
+ class CountReadable implements Readable {
+ int counter = 0;
+ public int read(CharBuffer charBuffer) throws IOException {
+ counter++;
+ charBuffer.append("hello\n");
+ return 6;
+ }
+ }
+ s = new Scanner(new CountReadable());
+ result = s.nextLine();
+ // We expect read() to be called only once, otherwise we see the problem
+ // when reading from System.in described in Harmony-4774
+ assertEquals(1, cis.counter);
+ assertEquals("hello", result);
}
/**
|