Add explicit append policy setter

This commit is contained in:
Nanaloveyuki
2026-05-10 12:49:08 +08:00
parent a71471ffb0
commit 0a7af44f06
8 changed files with 41 additions and 3 deletions
+5
View File
@@ -124,8 +124,11 @@ test "file sink rotation config normalizes invalid inputs" {
test "file sink setters update auto flush and rotation state" {
let sink = file_sink("bitlogger-setters.log")
inspect(sink.append_mode(), content="true")
inspect(sink.auto_flush_enabled(), content="true")
inspect(sink.rotation_enabled(), content="false")
sink.set_append_mode(false)
inspect(sink.append_mode(), content="false")
sink.set_auto_flush(false)
inspect(sink.auto_flush_enabled(), content="false")
sink.set_rotation(Some(file_rotation(32, max_backups=2)))
@@ -140,6 +143,8 @@ test "file sink setters update auto flush and rotation state" {
sink.clear_rotation()
inspect(sink.rotation_enabled(), content="false")
inspect(sink.rotation_config() is None, content="true")
inspect(sink.reopen(), content=if sink.is_available() { "true" } else { "false" })
inspect(sink.append_mode(), content="false")
}
test "file sink tracks rotation failures on unavailable backend" {