mirror of
https://github.com/gpujs/gpu.js.git
synced 2026-01-18 16:04:10 +00:00
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
43 lines
1.3 KiB
JavaScript
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);
|
|
});
|