From d426945255ffb093b6f8375198f62995c15889a5 Mon Sep 17 00:00:00 2001 From: Nanaloveyuki Date: Sun, 10 May 2026 13:51:12 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20Fix=20CI=20target=20selection=20?= =?UTF-8?q?and=20test=20expectations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 14 +++++++++++++- bitlogger/BitLogger_test.mbt | 16 ++++++++-------- bitlogger/BitLogger_wbtest.mbt | 4 ++-- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9eb3440..89e006e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,6 +35,18 @@ jobs: run: | moon test bitlogger - - name: Run example + - name: Check bitlogger native + run: | + moon check bitlogger --target native + + - name: Check bitlogger_async native + run: | + moon check bitlogger_async --target native + + - name: Run basic example run: | moon run examples/basic + + - name: Check async example native + run: | + moon check examples/async_basic --target native diff --git a/bitlogger/BitLogger_test.mbt b/bitlogger/BitLogger_test.mbt index 6304c0c..bab469c 100644 --- a/bitlogger/BitLogger_test.mbt +++ b/bitlogger/BitLogger_test.mbt @@ -158,7 +158,7 @@ test "config subtype json helpers stringify stable shapes" { template="[{level}] {message} :: {fields}", ), ), - content="{\"field_separator\":\",\",\"separator\":\" | \",\"show_fields\":true,\"show_level\":true,\"show_target\":false,\"show_timestamp\":false,\"template\":\"[{level}] {message} :: {fields}\"}", + content="{\"show_timestamp\":false,\"show_level\":true,\"show_target\":false,\"show_fields\":true,\"separator\":\" | \",\"field_separator\":\",\",\"template\":\"[{level}] {message} :: {fields}\"}", ) inspect( stringify_sink_config( @@ -171,7 +171,7 @@ test "config subtype json helpers stringify stable shapes" { text_formatter=TextFormatterConfig::new(show_timestamp=false), ), ), - content="{\"append\":false,\"auto_flush\":false,\"kind\":\"file\",\"path\":\"demo.log\",\"rotation\":{\"max_backups\":2,\"max_bytes\":128},\"text_formatter\":{\"field_separator\":\" \",\"separator\":\" \",\"show_fields\":true,\"show_level\":true,\"show_target\":true,\"show_timestamp\":false,\"template\":\"\"}}", + content="{\"kind\":\"file\",\"path\":\"demo.log\",\"append\":false,\"auto_flush\":false,\"text_formatter\":{\"show_timestamp\":false,\"show_level\":true,\"show_target\":true,\"show_fields\":true,\"separator\":\" \",\"field_separator\":\" \",\"template\":\"\"},\"rotation\":{\"max_bytes\":128,\"max_backups\":2}}", ) } @@ -292,7 +292,7 @@ test "file state json helpers stringify stable snapshots" { ) inspect( @json_parser.stringify(plain), - content="{\"append\":false,\"auto_flush\":true,\"available\":true,\"flush_failures\":3,\"open_failures\":1,\"path\":\"demo.log\",\"rotation\":{\"max_backups\":2,\"max_bytes\":64},\"rotation_failures\":4,\"write_failures\":2}", + content="{\"path\":\"demo.log\",\"available\":true,\"append\":false,\"auto_flush\":true,\"open_failures\":1,\"write_failures\":2,\"flush_failures\":3,\"rotation_failures\":4,\"rotation\":{\"max_bytes\":64,\"max_backups\":2}}", ) inspect( stringify_file_sink_state( @@ -308,7 +308,7 @@ test "file state json helpers stringify stable snapshots" { rotation_failures=0, ), ), - content="{\"append\":true,\"auto_flush\":false,\"available\":false,\"flush_failures\":0,\"open_failures\":0,\"path\":\"plain.log\",\"rotation\":null,\"rotation_failures\":0,\"write_failures\":0}", + content="{\"path\":\"plain.log\",\"available\":false,\"append\":true,\"auto_flush\":false,\"open_failures\":0,\"write_failures\":0,\"flush_failures\":0,\"rotation_failures\":0,\"rotation\":null}", ) } @@ -333,7 +333,7 @@ test "runtime file state json helpers stringify queue snapshots" { ) inspect( json, - content="{\"dropped_count\":5,\"file\":{\"append\":true,\"auto_flush\":false,\"available\":true,\"flush_failures\":2,\"open_failures\":0,\"path\":\"queue.log\",\"rotation\":null,\"rotation_failures\":3,\"write_failures\":1},\"pending_count\":7,\"queued\":true}", + content="{\"file\":{\"path\":\"queue.log\",\"available\":true,\"append\":true,\"auto_flush\":false,\"open_failures\":0,\"write_failures\":1,\"flush_failures\":2,\"rotation_failures\":3,\"rotation\":null},\"queued\":true,\"pending_count\":7,\"dropped_count\":5}", ) } @@ -348,7 +348,7 @@ test "file sink policy json helpers stringify stable policies" { ), ), ), - content="{\"append\":false,\"auto_flush\":true,\"rotation\":{\"max_backups\":3,\"max_bytes\":96}}", + content="{\"append\":false,\"auto_flush\":true,\"rotation\":{\"max_bytes\":96,\"max_backups\":3}}", ) inspect( stringify_file_sink_policy( @@ -544,10 +544,10 @@ test "configured logger can reopen built file sink" { inspect(logger.file_reopen_truncate(), content="false") inspect(logger.file_append_mode(), content="false") inspect(logger.file_reopen_with_current_policy(), content="false") - inspect(logger.file_open_failures(), content="3") + inspect(logger.file_open_failures(), content="4") inspect(logger.file_reopen_append(), content="false") inspect(logger.file_append_mode(), content="true") - inspect(logger.file_open_failures(), content="4") + inspect(logger.file_open_failures(), content="5") inspect(logger.file_reset_failure_counters(), content="true") inspect(logger.file_open_failures(), content="0") inspect(logger.file_write_failures(), content="0") diff --git a/bitlogger/BitLogger_wbtest.mbt b/bitlogger/BitLogger_wbtest.mbt index 9676298..cc0f075 100644 --- a/bitlogger/BitLogger_wbtest.mbt +++ b/bitlogger/BitLogger_wbtest.mbt @@ -277,10 +277,10 @@ test "file sink reopen and failure counters reflect backend state" { inspect(sink.reopen_truncate(), content="false") inspect(sink.append_mode(), content="false") inspect(sink.reopen_with_current_policy(), content="false") - inspect(sink.open_failures(), content="3") + inspect(sink.open_failures(), content="4") inspect(sink.reopen_append(), content="false") inspect(sink.append_mode(), content="true") - inspect(sink.open_failures(), content="4") + inspect(sink.open_failures(), content="5") sink.reset_failure_counters() inspect(sink.open_failures(), content="0") inspect(sink.write_failures(), content="0")