Skip to content

Commit 1795a25

Browse files
committed
Add broken test
1 parent fa4d849 commit 1795a25

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

lib/index.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -317,15 +317,22 @@ GLSL.prototype.transforms = {
317317

318318
//arg names
319319
var argsList = flatten(args.map(function (arg) {
320-
assert.equal(arg.type, 'decl', 'Struct statements should be declarations.')
320+
if (arg.type !== 'decl') throw Error('Struct statements should be declarations.')
321321

322322
var decllist = arg.children[arg.children.length - 1]
323323

324-
assert.equal(decllist.type, 'decllist', 'Struct statement declaration has wrong structure.')
324+
if (decllist.type !== 'decllist') throw Error('Struct statement declaration has wrong structure.')
325325

326-
return decllist.children.map(function (ident) {
327-
assert.equal(ident.type, 'ident', 'Struct statement contains something other than just identifiers.')
328-
return ident.data
326+
return decllist.children.map(function (node) {
327+
// { vec3 direction; }
328+
if (node.type === 'ident') return node.data
329+
330+
// { vec3 data[2]; }
331+
if (node.type === 'quantifier') {
332+
console.log(node)
333+
}
334+
335+
throw Error('Struct statement contains something strange.')
329336
})
330337
}))
331338

test/structs.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,16 @@ test('Anonymous', function (t) {
5757

5858
t.end()
5959
});
60+
61+
// FIXME
62+
test.skip('Quantifier', function (t) {
63+
t.equal(
64+
clean(compile(`struct Samples { sampler2D data[2]; };`)),
65+
clean(`
66+
var Samples = {
67+
direction: [0, 0, 0]
68+
};`)
69+
);
70+
71+
t.end()
72+
})

0 commit comments

Comments
 (0)