gpu.js/test/internal/backend/cpu/function-node.js
Robert Plummer b9f7d7bff0 fix: Move varWarn to and unit test that all FunctionNode's use it
fix: Test that getExtension is set to be able to use on TravisCI
fix: Remove wraparound, is no longer being used anywhere
fix: add getMemoryOptimizedPackedTextureSize to string kernel
fix: Remove console.log() usage
fix: Move addFunction functionality into new utils method `functionToIFunction`
fix: Fix mergeSettings to use `functions` settings and use `functionToIFunction`
fix: Remove the spread operator for now, for compatibility with safari
fix: Add typings for `setFunctions`
fix; Failing unit tests for sarafi
feat: Add CONTRIBUTING.md
feat: Add ISSUE_TEMPLATE.md
fix: Remove typescript from dependencies
fix: Document, document, document
fix: Bump version and build
2019-04-23 22:03:14 -04:00

35 lines
903 B
JavaScript

const { assert, skip, test, module: describe, only } = require('qunit');
const { CPUFunctionNode } = require('../../../../src');
describe('internal: CPUFunctionNode');
test('should call warn when using var is used in source', () => {
const node = new CPUFunctionNode(`function() { var v = 1; return v; }`, {
output: [1],
precision: 'unsigned',
argumentTypes: [],
name: 'kernel',
});
let called = false;
node.varWarn = () => {
called = true;
};
node.toString();
assert.ok(called);
});
test('should not call warn when using const or let is used in source', () => {
const node = new CPUFunctionNode(`function() { const v1 = 1; let v2 = 2; return v1; }`, {
output: [1],
precision: 'unsigned',
argumentTypes: [],
name: 'kernel',
});
let called = false;
node.varWarn = () => {
called = true;
};
node.toString();
assert.notOk(called);
});