Skip to content

Commit

Permalink
Add test for starting a substack beyond branchCount
Browse files Browse the repository at this point in the history
  • Loading branch information
GarboMuffin committed Jan 14, 2024
1 parent d47a096 commit ce0b7d7
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
Binary file added test/fixtures/tw-beyond-branchCount.sb3
Binary file not shown.
27 changes: 27 additions & 0 deletions test/integration/tw_conditional_and_loop.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,5 +193,32 @@ for (const Extension of [TestExtensionUsingReturn, TestExtensionUsingStartBranch
vm.start();
});
});

test(`beyond branchCount - ${Extension.name} - ${compilerEnabled ? 'compiled' : 'interpreted'}`, t => {
t.plan(1);

const vm = new VirtualMachine();
vm.setCompilerOptions({
enabled: compilerEnabled
});
vm.extensionManager.addBuiltinExtension('loopsAndThings', Extension);
vm.runtime.on('COMPILE_ERROR', () => {
t.fail('Compile error');
});

vm.loadProject(fs.readFileSync(path.join(__dirname, '../fixtures/tw-beyond-branchCount.sb3'))).then(() => {
vm.runtime.on('SAY', (target, type, text) => {
if (text === 'BeyondBranchCount') {
t.pass('BeyondBranchCount');
} else if (text === 'end') {
vm.quit();
t.end();
}
});

vm.greenFlag();
vm.start();
});
});
}
}

0 comments on commit ce0b7d7

Please sign in to comment.