Add bilingual public docs, keyword aliases, and frontmatter stdin for view.
English/Chinese user pages sit side by side; L0 builtins and lib/ text|表 dual APIs land with gold coverage. Capture/view input demos use stdin:/输入: so static export and first page load succeed. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
fd36b92224
commit
a5d30c00b3
68 files changed
+1812
-241
No files matched your search
@@ -0,0 +1,7 @@
|
||||
---
|
||||
title: empty split sep
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
*`xs` = > split value=ab sep=*
|
||||
@@ -165,6 +165,94 @@ fn bytecode_stdlib() {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
#[test]
|
||||
fn keywords_stdlib_more() {
|
||||
assert_out(
|
||||
"tests/keywords/stdlib-more.mq.md",
|
||||
"hi
|
||||
3
|
||||
b
|
||||
a-b-c
|
||||
list",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bytecode_stdlib_more() {
|
||||
assert_out_backend(
|
||||
"tests/keywords/stdlib-more.mq.md",
|
||||
"bytecode",
|
||||
"hi
|
||||
3
|
||||
b
|
||||
a-b-c
|
||||
list",
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
#[test]
|
||||
fn keywords_zh_builtins() {
|
||||
assert_out(
|
||||
"tests/keywords/zh-builtins.mq.md",
|
||||
"5
|
||||
7",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bytecode_zh_builtins() {
|
||||
assert_out_backend(
|
||||
"tests/keywords/zh-builtins.mq.md",
|
||||
"bytecode",
|
||||
"5
|
||||
7",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn keywords_zh_bool() {
|
||||
assert_out(
|
||||
"tests/keywords/zh-bool.mq.md",
|
||||
"ok
|
||||
none-falsy",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bytecode_zh_bool() {
|
||||
assert_out_backend(
|
||||
"tests/keywords/zh-bool.mq.md",
|
||||
"bytecode",
|
||||
"ok
|
||||
none-falsy",
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
#[test]
|
||||
fn structure_import_lib() {
|
||||
assert_out(
|
||||
"tests/structure/import-lib.mq.md",
|
||||
"x
|
||||
2
|
||||
a",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bytecode_import_lib() {
|
||||
assert_out_backend(
|
||||
"tests/structure/import-lib.mq.md",
|
||||
"bytecode",
|
||||
"x
|
||||
2
|
||||
a",
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
#[test]
|
||||
fn error_undefined_var() {
|
||||
assert_err(
|
||||
@@ -215,6 +303,15 @@ fn error_bad_int() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn error_bad_split_sep() {
|
||||
assert_err(
|
||||
"tests/errors/bad-split-sep.mq.md",
|
||||
"7:1",
|
||||
"split sep must not be empty",
|
||||
);
|
||||
}
|
||||
|
||||
fn assert_out_backend(path: &str, backend: &str, expect: &str) {
|
||||
let (code, stdout, stderr) = run(&["run", path, "--backend", backend]);
|
||||
assert_eq!(code, 0, "{path} backend={backend} stderr={stderr}");
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
---
|
||||
title: stdlib text and table
|
||||
description: trim split join at type + lib imports
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
*`raw` = hi *
|
||||
|
||||
*`t` = > trim `raw`*
|
||||
|
||||
> print text=`t`
|
||||
|
||||
*`parts` = > split value=a,b,c sep=,*
|
||||
|
||||
*`n` = > len `parts`*
|
||||
|
||||
> print text=`n`
|
||||
|
||||
*`mid` = > at value=`parts` index=1*
|
||||
|
||||
> print text=`mid`
|
||||
|
||||
*`joined` = > join value=`parts` sep=-*
|
||||
|
||||
> print text=`joined`
|
||||
|
||||
*`ty` = > type `parts`*
|
||||
|
||||
> print text=`ty`
|
||||
@@ -0,0 +1,20 @@
|
||||
---
|
||||
title: 中文布尔与逻辑
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
*`a` = 真*
|
||||
*`b` = 假*
|
||||
|
||||
+ `a` 且 非 `b`
|
||||
> 打印 内容=ok
|
||||
+ *
|
||||
> 打印 内容=fail
|
||||
|
||||
*`probe` = 1*
|
||||
|
||||
+ 空
|
||||
> 打印 内容=none-truthy
|
||||
+ *
|
||||
> 打印 内容=none-falsy
|
||||
@@ -0,0 +1,18 @@
|
||||
---
|
||||
title: 中文内置函数
|
||||
description: 打印 / 长度 / 文本 / 整数(与英文别名等价)
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
*`s` = hello*
|
||||
|
||||
*`n` = > 长度 值=`s`*
|
||||
|
||||
> 打印 内容=`n`
|
||||
|
||||
*`t` = > 文本 值=7*
|
||||
|
||||
*`i` = > 整数 值=`t`*
|
||||
|
||||
> 打印 内容=`i`
|
||||
@@ -0,0 +1,26 @@
|
||||
---
|
||||
title: import official lib (Chinese)
|
||||
> lib/文本.mq.md
|
||||
> lib/表.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
*`t` = > 去空白 s= x *
|
||||
|
||||
> 打印 内容=`t`
|
||||
|
||||
`xs` =
|
||||
|
||||
| v |
|
||||
|---|
|
||||
| a |
|
||||
| b |
|
||||
|
||||
*`n` = > 行数 xs=`xs`*
|
||||
|
||||
> 打印 内容=`n`
|
||||
|
||||
*`row` = > 取行 xs=`xs` i=0*
|
||||
|
||||
> 打印 内容=`row`
|
||||
Reference in new issue
Block a user