MCPcopy Create free account
hub / github.com/aiscript-dev/aiscript / exeAndGetErrPos

Function exeAndGetErrPos

test/interpreter.ts:70–79  ·  view source on GitHub ↗
(src: string)

Source from the content-addressed store, hash-verified

68
69describe('error location', () => {
70 const exeAndGetErrPos = (src: string): Promise<Ast.Pos|undefined> => new Promise((ok, ng) => {
71 const aiscript = new Interpreter({
72 emitError: FN_NATIVE((_args, _opts) => {
73 throw Error('emitError');
74 }),
75 }, {
76 err(e) { ok(e.pos) },
77 });
78 aiscript.exec(Parser.parse(src)).then(() => ng('error has not occured.'));
79 });
80
81 test.concurrent('Non-aiscript Error', async () => {
82 return expect(exeAndGetErrPos(`/* (の位置

Callers 1

interpreter.tsFile · 0.85

Calls 3

execMethod · 0.95
FN_NATIVEFunction · 0.85
parseMethod · 0.45

Tested by

no test coverage detected