mirror of
https://github.com/Youzini-afk/ST-Bionic-Memory-Ecology.git
synced 2026-05-15 22:30:38 +08:00
refactor: purify task worldinfo and ejs runtime
This commit is contained in:
@@ -129,6 +129,12 @@ try {
|
||||
if (template === "<% broken") {
|
||||
throw new Error("Unexpected end of input");
|
||||
}
|
||||
if (template === "<% await execute() %>") {
|
||||
return async function compiled(locals) {
|
||||
await locals.execute();
|
||||
return "";
|
||||
};
|
||||
}
|
||||
return async function compiled(locals) {
|
||||
return [
|
||||
locals.charName,
|
||||
@@ -167,6 +173,13 @@ try {
|
||||
);
|
||||
assert.deepEqual(compileCalls, ["<%= 1 %>", "<%= 1 %>"]);
|
||||
|
||||
await assert.rejects(
|
||||
() => evalTaskEjsTemplate("<% await execute() %>", renderCtx),
|
||||
(error) =>
|
||||
error?.code === "st_bme_task_ejs_unsupported_helper" &&
|
||||
error?.helperName === "execute",
|
||||
);
|
||||
|
||||
const syntaxError = await checkTaskEjsSyntax("<% broken");
|
||||
assert.equal(syntaxError, "Unexpected end of input");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user