migrate: own the HTTP domain module as an explicit package

Move the pre-migration net/http.mq.md content into this repository's package
entry, replacing the bundle-relative utf8 import with the public std:text/utf8
dependency. The module leaves the default Bundle and is consumed through the
explicit @http package import; the original domain test and its baseline
terminal value are carried over unchanged.

Refs cflmy/marqdo#9, cflmy/marqdo-ext-http#1
This commit was merged in pull request #2.
This commit is contained in:
cflmy committed 2026-11-27 00:07:52 +08:00
1 parent f2dde4234c
commit 368b33d241
8 files changed
+713 -6

No files matched your search

+5 -1
View File
@@ -1,3 +1,7 @@
# 验收测试
首个功能附带正例和失败用例,记录所用 CLI 提交或发行版本以及实际运行命令。
`tests/*.mq.md` 是从迁移前 CLI 官方标准库自测迁入的真实测试源,导入已改为公开 Package 别名(`@alias`);`tests/cases/*.json` 固定输入(stdin、CLI 参数、环境、依赖别名)与期望结果(observation 终值、stdout)。
运行入口是 `scripts/test.sh`,要求显式传入 `MARQDO_BIN` 与 `MARQDO_STDLIB_DIR`。运行器为每个 case 建立临时消费者工程(`dependencies.<alias>.path` 指向本仓 Package 副本),先 `marqdo lock` 再通过公开 `@alias` 导入执行,不读取兄弟仓路径或浮动分支。
期望值取自迁移前基线 Bundle 的真实执行结果;修改期望值等于声明公开行为变化,必须单独评审。
+48
View File
@@ -0,0 +1,48 @@
{
"schema": "marqdo.package-test-case",
"schema_version": 1,
"name": "http",
"file": "http.mq.md",
"dep_alias": "http",
"args": [],
"stdin": "",
"env": {},
"expected_stdout": "",
"expected_terminal": {
"items": [
{
"decimal": "200",
"type": "int"
},
{
"type": "text",
"value": "OK"
},
{
"type": "text",
"value": "text/plain"
},
{
"type": "text",
"value": "hello world"
},
{
"type": "text",
"value": "POST /echo HTTP/1.1\r\nHost: example.test\r\nContent-Length: 2\r\n\r\nok"
},
{
"decimal": "200",
"type": "int"
},
{
"type": "text",
"value": "你好"
},
{
"type": "text",
"value": "POST / HTTP/1.1\r\n\r\nAB"
}
],
"type": "list"
}
}
+24
View File
@@ -0,0 +1,24 @@
---
import:
http: "@http"
---
# @exec http
## main
**响应文本 = "HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\nTransfer-Encoding: chunked\r\n\r\n5\r\nhello\r\n6\r\n world\r\n0\r\n\r\n"**
**响应 = http.解析响应(响应文本)**
**请求 = http.构建请求("POST", "/echo", [["Host", "example.test"], ["Content-Length", "2"]], "ok")**
**响应字节 = http.解析响应字节(http.文本字节("HTTP/1.1 200 OK\r\nTransfer-Encoding: chunked\r\n\r\n6\r\n你好\r\n0\r\n\r\n"))**
**正文 = http.字节文本(响应字节.value.body)**
**请求字节 = http.构建请求字节("POST", "/", [], [65, 66])**
**请求文本 = http.字节文本(请求字节)**
`return [响应.状态, 响应.原因, 响应.头["Content-Type"], 响应.体, 请求, 响应字节.value.status, 正文.value, 请求文本.value]`