Robert Plummer 82832902cc fix: Move jellyfish images to actual files
fix: added `warnVarUsage` and `Dealing With Transpilation`
fix: Test dynamic arguments and provide some fixes for
fix: Dynamic arguments for `CPUFunctionNode`
fix: Dynamic arguments for `WebGLKernelValueDynamicHTMLImage`, `WebGLKernelValueDynamicNumberTexture`, `WebGLKernelValueDynamicSingleInput`, `WebGL2KernelValueDynamicHTMLImage`, `WebGL2KernelValueDynamicNumberTexture`, and `WebGL2KernelValueDynamicSingleInput`
fix: `onRequestFallback` settings in `createKernel` and `createKernel` inclusion of `loopMaxIterations`, `dynamicOutput`, and `dynamicArgument` in settings for when switching kernels
fix: `WebGL2Kernel` and `HeadlessGLKernel` typescript definition extensions
2019-07-05 11:03:25 -04:00

43 lines
1.3 KiB
JavaScript

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