mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-08-28 22:30:40 -04:00
Merge pull request #925 from LukeSchlangen/fix/rounding-numbers
round numbers but break tests
This commit is contained in:
commit
8d42db7df8
2 changed files with 24 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
|||
const test = require('tap').test;
|
||||
const Looks = require('../../src/blocks/scratch3_looks');
|
||||
const Runtime = require('../../src/engine/runtime');
|
||||
const util = {
|
||||
target: {
|
||||
currentCostume: 0, // Internally, current costume is 0 indexed
|
||||
|
@ -50,3 +51,20 @@ test('getBackdropNumberName can return costume name', t => {
|
|||
t.strictEqual(number, 'third name');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('numbers should be rounded to two decimals in say', t => {
|
||||
const rt = new Runtime();
|
||||
const looks = new Looks(rt);
|
||||
|
||||
const args = {MESSAGE: 3.14159};
|
||||
const expectedSayString = '3.14';
|
||||
|
||||
rt.removeAllListeners('SAY'); // Prevent say blocks from executing
|
||||
|
||||
rt.addListener('SAY', (target, type, sayString) => {
|
||||
t.strictEqual(sayString, expectedSayString);
|
||||
t.end();
|
||||
});
|
||||
|
||||
looks.say(args, util);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue