migrate: own the regex domain module as an explicit package

Move the pre-migration regex.mq.md content into this repository's package
entry. The module leaves the default Bundle and is consumed through the
explicit @regex package import; the pure subset and the existing host-backed
paths keep their behaviour and the original test terminal value.

Refs cflmy/marqdo#9, cflmy/marqdo-ext-regex#1
This commit was merged in pull request #2.
This commit is contained in:
cflmy committed 2026-11-27 00:07:54 +08:00
1 parent 5458dff039
commit 6e7e633798
8 files changed
+871 -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 的真实执行结果;修改期望值等于声明公开行为变化,必须单独评审。
+89
View File
@@ -0,0 +1,89 @@
{
"schema": "marqdo.package-test-case",
"schema_version": 1,
"name": "regex",
"file": "regex.mq.md",
"dep_alias": "regex",
"args": [],
"stdin": "",
"env": {},
"expected_stdout": "",
"expected_terminal": {
"items": [
{
"type": "bool",
"value": true
},
{
"type": "bool",
"value": false
},
{
"type": "bool",
"value": true
},
{
"type": "bool",
"value": true
},
{
"type": "bool",
"value": true
},
{
"type": "bool",
"value": true
},
{
"type": "bool",
"value": true
},
{
"type": "bool",
"value": true
},
{
"type": "bool",
"value": true
},
{
"type": "bool",
"value": false
},
{
"type": "text",
"value": "regex.invalid"
},
{
"type": "text",
"value": "regex.unsupported"
},
{
"type": "bool",
"value": true
},
{
"type": "bool",
"value": true
},
{
"items": [
{
"type": "text",
"value": "aab"
},
{
"type": "text",
"value": "aa"
},
{
"type": "text",
"value": "b"
}
],
"type": "list"
}
],
"type": "list"
}
}
+36
View File
@@ -0,0 +1,36 @@
---
import:
regex: "@regex"
---
# @exec regex
## main
**`星号 = regex.匹配("a*b", "aaab")`**
**`加号 = regex.匹配("a+b", "b")`**
**`锚点 = regex.匹配("^a.*z$", "abcz")`**
**`类 = regex.匹配("[a-c]+", "abc")`**
**`否定类 = regex.匹配("[^0-9]", "a")`**
**`任意 = regex.匹配("a.a", "aba")`**
**`可选 = regex.匹配("a?b", "b")`**
**`转义 = regex.匹配("\\.", ".")`**
**`搜索 = regex.搜索("b+c", "xxbbcyy")`**
**`无效 = regex.匹配("[a", "a")`**
**`不支持 = regex.匹配("(a)", "a")`**
**扩展 = regex.扩展匹配("^(a+)(b|c)$", "aab")**
**捕获 = regex.捕获("^(a+)(b|c)$", "aab")**
`return [星号.value, 加号.value, 锚点.value, 类.value, 否定类.value, 任意.value, 可选.value, 转义.value, 搜索.value, 无效.ok, 无效.code, 不支持.code, 扩展.value, 捕获.value.matched, 捕获.value.groups]`