[GH-ISSUE #5381] horizon-server-files: two server.properties tests fail on Windows (they expect "\n", store writes "\r\n") #1658

Closed
opened 2026-11-02 15:48:42 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @mariuslozo-boop on GitHub (Oct 31, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/5381

Originally assigned to: @mariuslozo-boop on GitHub.

🤖 Filed by mariuslozo-boop's AI agent (Claude Code, Claude Opus 5.5), not by mariuslozo-boop personally.

On Windows, cargo test -p horizon-server-files fails two tests on main (64b84a780):

test java_properties::tests::stores_sorted_and_escaped ... FAILED
test properties::tests::defaults_match_vanilla_init_settings ... FAILED
  left: "#Minecraft server properties\r\n#DATE\r\nb\\ key=é\r\nlevel-type=minecraft\\:normal\r\nmotd=\\ A\\=B\\#\r\n"
 right: "#Minecraft server properties\n#DATE\nb\\ key=é\nlevel-type=minecraft\\:normal\nmotd=\\ A\\=B\\#\n"

Properties::store ends lines with line_separator(), which is "\r\n" on Windows. That matches vanilla:
Settings.store calls java.util.Properties.store(Writer, …), which ends every line with
BufferedWriter.newLine(), which writes System.lineSeparator(). JDK 25 on Windows writes CRLF there.
So the code is right and the tests are wrong: they hard-code "\n".

Fix: the tests compare with the platform separator. Linux and macOS don't change.

Originally created by @mariuslozo-boop on GitHub (Oct 31, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/5381 Originally assigned to: @mariuslozo-boop on GitHub. > 🤖 Filed by mariuslozo-boop's AI agent (Claude Code, Claude Opus 5.5), not by mariuslozo-boop personally. On Windows, `cargo test -p horizon-server-files` fails two tests on main (64b84a780): ``` test java_properties::tests::stores_sorted_and_escaped ... FAILED test properties::tests::defaults_match_vanilla_init_settings ... FAILED left: "#Minecraft server properties\r\n#DATE\r\nb\\ key=é\r\nlevel-type=minecraft\\:normal\r\nmotd=\\ A\\=B\\#\r\n" right: "#Minecraft server properties\n#DATE\nb\\ key=é\nlevel-type=minecraft\\:normal\nmotd=\\ A\\=B\\#\n" ``` `Properties::store` ends lines with `line_separator()`, which is `"\r\n"` on Windows. That matches vanilla: `Settings.store` calls `java.util.Properties.store(Writer, …)`, which ends every line with `BufferedWriter.newLine()`, which writes `System.lineSeparator()`. JDK 25 on Windows writes CRLF there. So the code is right and the tests are wrong: they hard-code `"\n"`. Fix: the tests compare with the platform separator. Linux and macOS don't change.
Author
Owner

@mariuslozo-boop commented on GitHub (Oct 31, 2026):

🤖 Agent: /claim

<!-- gh-comment-id:6547486519 --> @mariuslozo-boop commented on GitHub (Oct 31, 2026): 🤖 Agent: /claim
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#1658
No description provided.