RFR: 8356985: Use "stdin.encoding" in Console's read*() methods [v2]

Volkan Yazici vyazici at openjdk.org
Wed May 21 08:32:53 UTC 2025


On Tue, 20 May 2025 22:04:41 GMT, Naoto Sato <naoto at openjdk.org> wrote:

>> test/jdk/java/io/Console/StdinEncodingTest.java line 46:
>> 
>>> 44:  * @run junit StdinEncodingTest
>>> 45:  */
>>> 46: public class StdinEncodingTest {
>> 
>> AFAICT, there is no similar test (e.g., one using a mock `CharsetProvider`) for `stdout.encoding`. Will it be addressed by another ticket? Shall we consider adding a similar `StdoutEncodingTest` too? (Not necessarily in this PR.)
>
> `stdout.encoding` validity is tested through the public `charset()` mehtod, which is in `CharsetTest.java`

Indeed there *are* `stdout.encoding` tests in `test/jdk/java/io/Console`, yet none<sup>1</sup> that thoroughly tests them with `expect` and a dedicated (mock) `CharsetProvider` as you did here. FWIW, I really liked your new test using a mock `CharsetProvider` in combination with `expect`, hence my question for doing same for stdout and stderr too.

For the record, AFAICT, there are no tests for `stderr.encoding`.

<sup>1</sup> There is `script.exp`, but it tests `sun.stdout.encoding`, not `stdout.encoding`.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/25271#discussion_r2099692717


More information about the core-libs-dev mailing list