migrate: own the text and UTF-8 sources and their baseline assertions

Move the official stdlib text modules to their unique source authority and
freeze the bundle-root paths (std:text, std:text/utf8). text.utf8编码 becomes a
thin wrapper over the single UTF-8 implementation in text/utf8.mq.md.

Carry the pre-migration product assertions into component-owned cases with the
baseline observation terminal values, plus an explicit-input test entry point
(MARQDO_BIN + MARQDO_STDLIB_DIR). No parser, host or CLI change.

Refs cflmy/marqdo#9, cflmy/marqdo-std-text#1
This commit is contained in:
cflmy committed 2026-11-26 23:10:18 +08:00
1 parent 9f1e862953
commit e15256300f
10 files changed
+602 -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 校验失败时必须失败,不得回退到其它目录。
期望值取自迁移前基线 CLI 的真实执行结果;任何期望值改动都必须作为公开行为变化单独评审并记录证据。
+28
View File
@@ -0,0 +1,28 @@
{
"schema": "marqdo.stdlib-test-case",
"schema_version": 1,
"name": "text",
"file": "text.mq.md",
"require_module": "text.mq.md",
"args": [],
"stdin": "",
"env": {},
"expected_stdout": "",
"expected_terminal": {
"items": [
{
"decimal": "2",
"type": "int"
},
{
"decimal": "195",
"type": "int"
},
{
"decimal": "169",
"type": "int"
}
],
"type": "list"
}
}
+28
View File
@@ -0,0 +1,28 @@
{
"schema": "marqdo.stdlib-test-case",
"schema_version": 1,
"name": "utf8",
"file": "utf8.mq.md",
"require_module": "text/utf8.mq.md",
"args": [],
"stdin": "",
"env": {},
"expected_stdout": "",
"expected_terminal": {
"items": [
{
"decimal": "2",
"type": "int"
},
{
"type": "text",
"value": "é"
},
{
"type": "bool",
"value": false
}
],
"type": "list"
}
}
+14
View File
@@ -0,0 +1,14 @@
---
import:
text_lib: "std:text"
---
# @exec text
## main
**内存 = memory.new(1, 1)**
**长度 = text_lib.utf8编码("é", 内存, 0)**
`return [长度, 内存[0], 内存[1]]`
+14
View File
@@ -0,0 +1,14 @@
---
import:
utf8: "std:text/utf8"
---
# @exec utf8
## main
**内存 = memory.new(1, 1)**
**长度 = utf8.编码("é", 内存, 0)**
`return [长度, utf8.解码(内存, 0, 长度).value, utf8.解码(内存, 0, 1).ok]`