History log of /libcore/luni/src/test/java/libcore/java/io/OutputStreamWriterTest.java
Revision Date Author Comments
555453327f26f4c9c610caa2851c87c3794c7764 31-Jan-2011 Elliott Hughes <enh@google.com> Tidying of OutputStreamWriter and a couple of related tests.

Change-Id: I591f573cd1e57f7bce8f47db29c8838896fa8b0b
3bdd9bb460941429ab11dfa13596768f3dc246ad 31-Jan-2011 Elliott Hughes <enh@google.com> Fix OutputStreamWriter's handling of surrogates.

CharsetEncoder doesn't behave how you'd expect. It doesn't track surrogate
pairs across calls to encode. This is true of the RI, too, not just our
ICU-based implementation. (I've included new CharsetEncoder tests to
demonstrate this. They don't all pass on Android, because we don't behave
exactly the same, but we're the same as far as is relevant for this
OutputStreamWriter bug.)

I've added new OutputStreamWriter tests too, that test the actual behavior
beyond the trivial "do we throw IllegalStateException?" tests harmony
had. Their fix for this bug didn't fix the real problem, but this patch
fixes both of the failures I found.

I think there's probably another one (marked with a TODO), but I haven't
been able to write a test to provoke it yet, and I'm unwilling to add code
I can't test.

I've also changed the behavior of OutputStreamWriter.write so that we don't
flush the underlying stream. This was a bug: only OutputStreamWriter.flush
should flush the underlying stream (as opposed to "flush" in the sense of
writing bytes from OutputStreamWriter's buffer into the underlying stream).
I've confirmed the truth of this assertion with another test.

Bug: 3403615
Change-Id: I567d49403b5498f4fb0a70fa3bfde0bd02ef430e