From ec1d8c657eb1753756c5cf8e23999badd5e309d8 Mon Sep 17 00:00:00 2001 From: Paul Kaplan Date: Wed, 25 Oct 2017 10:14:03 -0400 Subject: [PATCH] Add failing test for callNoReturn on undefined proc --- test/unit/blocks_procedures.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 test/unit/blocks_procedures.js diff --git a/test/unit/blocks_procedures.js b/test/unit/blocks_procedures.js new file mode 100644 index 000000000..4ecdb41d8 --- /dev/null +++ b/test/unit/blocks_procedures.js @@ -0,0 +1,28 @@ +const test = require('tap').test; +const Procedures = require('../../src/blocks/scratch3_procedures'); + +const blocks = new Procedures(null); + +test('getPrimitives', t => { + t.type(blocks.getPrimitives(), 'object'); + t.end(); +}); + +// Originally inspired by https://github.com/LLK/scratch-gui/issues/809 +test('calling a custom block with no definition does not throw', t => { + const args = { + mutation: { + proccode: 'undefined proc' + } + }; + const util = { + getProcedureParamNames: () => null, + stackFrame: { + executed: false + } + }; + t.doesNotThrow(() => { + blocks.callNoReturn(args, util); + }); + t.end(); +});