migrate: own format/io/console/stream sources and preserve the print alias target

Move the official stdlib IO modules to their unique source authority and keep
the frozen public paths, including io.mq.md#写值 as the official print/打印 alias
target. Carry the pre-migration product assertions into component cases with
real resource-endpoint evidence for console.

Refs cflmy/marqdo#9, cflmy/marqdo-std-io#1
This commit was merged in pull request #2.
This commit is contained in:
cflmy committed 2026-11-26 23:30:27 +08:00
1 parent 945e76eed8
commit e18b0b1b40
16 files changed
+1043 -6

No files matched your search

+5 -1
View File
@@ -1,3 +1,7 @@
# 验收测试
首个功能附带正例和失败用例,记录所用 CLI 提交或发行版本以及实际运行命令。
`tests/*.mq.md` 是从迁移前 CLI 官方标准库自测迁入的真实测试源;`tests/cases/*.json` 固定每个测试的输入(stdin、CLI 参数、环境、所需 Bundle 模块)和期望结果(observation 终值、stdout、必要的资源事件)。
运行入口是 `scripts/test.sh`,它要求显式传入 `MARQDO_BIN` 与 `MARQDO_STDLIB_DIR`。缺少制品、Bundle 缺少模块或 digest 校验失败时必须失败,不得回退到其它目录。
期望值取自迁移前基线 Bundle(`sha256:5407d36...`)与已验证候选 CLI 的真实执行结果;任何期望值改动都必须作为公开行为变化单独评审并记录证据。
+32
View File
@@ -0,0 +1,32 @@
{
"schema": "marqdo.stdlib-test-case",
"schema_version": 1,
"name": "console",
"file": "console.mq.md",
"require_module": "io/console.mq.md",
"args": [],
"stdin": "hello\n",
"env": {},
"expected_stdout": "",
"expected_terminal": {
"items": [
{
"type": "bool",
"value": true
},
{
"type": "text",
"value": "hello"
}
],
"type": "list"
},
"event_checks": [
{
"kind": "effect",
"payload": {
"operation": "resource.read"
}
}
]
}
+36
View File
@@ -0,0 +1,36 @@
{
"schema": "marqdo.stdlib-test-case",
"schema_version": 1,
"name": "format",
"file": "format.mq.md",
"require_module": "format.mq.md",
"args": [],
"stdin": "",
"env": {},
"expected_stdout": "",
"expected_terminal": {
"items": [
{
"decimal": "3",
"type": "int"
},
{
"type": "text",
"value": "[\"文本\", 2, 1.5]"
},
{
"type": "text",
"value": "{a: 1}"
},
{
"type": "text",
"value": "[\"a\", 2]"
},
{
"type": "text",
"value": "None"
}
],
"type": "list"
}
}
+14
View File
@@ -0,0 +1,14 @@
{
"schema": "marqdo.stdlib-test-case",
"schema_version": 1,
"name": "io",
"file": "io.mq.md",
"require_module": "io.mq.md",
"args": [],
"stdin": "",
"env": {},
"expected_stdout": "stdlib self-test\n",
"expected_terminal": {
"type": "none"
}
}
+24
View File
@@ -0,0 +1,24 @@
{
"schema": "marqdo.stdlib-test-case",
"schema_version": 1,
"name": "stream",
"file": "stream.mq.md",
"require_module": "io/stream.mq.md",
"args": [],
"stdin": "",
"env": {},
"expected_stdout": "stream\n",
"expected_terminal": {
"items": [
{
"type": "bool",
"value": true
},
{
"decimal": "7",
"type": "int"
}
],
"type": "list"
}
}
+12
View File
@@ -0,0 +1,12 @@
---
import:
console: "std:io/console"
---
# @exec console
## main
**行 = console.读取行()**
`return [行.ok, 行.value]`
+10
View File
@@ -0,0 +1,10 @@
---
import:
format: "std:format"
---
# @exec format
## main
`return [format.字节长度("Aé"), format.显示(["文本", 2, 1.5]), format.显示({a: 1}), format.列表显示(["a", 2]), format.显示(None)]`
+12
View File
@@ -0,0 +1,12 @@
---
import:
io: "std:io"
---
# @exec io
## main
> **io.写值("stdlib self-test")**
`return None`
+12
View File
@@ -0,0 +1,12 @@
---
import:
stream: "std:io/stream"
---
# @exec stream
## main
**结果 = stream.写文本("stream\n")**
`return [结果.ok, 结果.value.count]`