宏扫描认酒馆的连带花括号写法,并补上示例对话宏。
{{{setvar::x::}} 的首个花括号在酒馆里是字面量,以前整段漏进正文;顺手把 mesExamples 接进来,导入报告也用酒馆写法显示宏名。
This commit is contained in:
@@ -106,6 +106,23 @@ describe("expandMacros", () => {
|
||||
expect(r.hits).toEqual([]);
|
||||
});
|
||||
|
||||
it("{{{setvar::x::}} 里第一个花括号是字面量(酒馆语义)", () => {
|
||||
const vars = createMacroVars();
|
||||
const r = expandMacros("{{{setvar::SEMOD1::}}\n[RESET]", { vars });
|
||||
expect(r.text).toBe("{\n[RESET]");
|
||||
expect(vars.get("SEMOD1")).toBe("");
|
||||
});
|
||||
|
||||
it("{{mesExamples}} 有上下文就展开,没有就原样保留", () => {
|
||||
expect(expandMacros("[{{mesExamples}}]", { mesExamples: "<START>\nUser: 甲" }).text).toBe(
|
||||
"[<START>\nUser: 甲]",
|
||||
);
|
||||
expect(expandMacros("[{{mesExamples}}]").text).toBe("[{{mesExamples}}]");
|
||||
});
|
||||
|
||||
it("三花括号里的宏也进导入报告(按 setvar 计)", () => {
|
||||
expect(collectMacroNames("{{{setvar::a::}}")).toContain("{{setvar}}");
|
||||
});
|
||||
it("collectMacroNames reports unknown macros by raw text", () => {
|
||||
const names = collectMacroNames(
|
||||
"{{// c}}{{user}}{{setvar::a::b}}{{turnPlus1}}{{roll 9}}",
|
||||
|
||||
Reference in New Issue
Block a user