feat(stdlib): Mid2 M10 stats and log fields

Add thin mean/median/stdev and optional structured fields on log
lines; close Mid2 M7–M10 (zip skipped).

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cflmyandCursor committed 2026-09-09 09:42:13 +08:00
1 parent 955834e453
commit 784d5ec346
22 files changed
+394 -32

No files matched your search

+16
View File
@@ -1242,6 +1242,22 @@ fn lib_fs_mid2_smoke_zh() {
assert_out("tests/lib/文件-mid2-烟测.mq.md", "True\n2\nFalse");
}
#[test]
fn lib_stats_log_smoke() {
assert_out(
"tests/lib/stats-log-smoke.mq.md",
"2.5\n2.5\n1.2909944487\nINFO hi user=alice n=3",
);
}
#[test]
fn lib_stats_log_smoke_zh() {
assert_out(
"tests/lib/统计-日志-烟测.mq.md",
"3\nINFO 你好 谁=甲 n=1",
);
}
#[test]
fn lib_re_smoke() {
assert_out(
+33
View File
@@ -0,0 +1,33 @@
---
title: lib/stats + log fields M10 smoke
import stats:lib/stats.mq.md
import log:lib/log.mq.md
---
# main
`xs` =
| |
|---|
| 1 |
| 2 |
| 3 |
| 4 |
*m = > stats.mean list=`xs`*
> print text=`m`
*med = > stats.median list=`xs`*
> print text=`med`
*s = > stats.stdev list=`xs`*
> print text=`s`
`fld` =
| user | n |
|------|---|
| alice | 3 |
> log.info text="hi" fields=`fld`
+25
View File
@@ -0,0 +1,25 @@
---
title: lib/统计 日志 M10 烟测
导入 统计:lib/统计.mq.md
导入 日志:lib/日志.mq.md
---
# main
`xs` =
| |
|---|
| 2 |
| 4 |
*m = > 统计.均值 列表=`xs`*
> print text=`m`
`fld` =
| 谁 | n |
|----|---|
| 甲 | 1 |
> 日志.信息 内容="你好" 字段=`fld`