Skip to content

Commit e1dbc13

Browse files
committed
Test mixed-case operators
1 parent c0e25f8 commit e1dbc13

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

test.js

+21-15
Original file line numberDiff line numberDiff line change
@@ -82,22 +82,28 @@ it('parses `AND`, `OR` and `WITH` with the correct precedence', function () {
8282
)
8383
})
8484

85-
it('allows lower-case `and`, `or`, and `with` by default', function () {
86-
assert.deepStrictEqual(
87-
p('MIT and BSD-3-Clause or GPL-2.0 with GCC-exception-2.0'),
88-
{
89-
left: {
90-
left: { license: 'MIT' },
91-
conjunction: 'and',
92-
right: { license: 'BSD-3-Clause' }
93-
},
94-
conjunction: 'or',
95-
right: {
96-
license: 'GPL-2.0',
97-
exception: 'GCC-exception-2.0'
98-
}
85+
it('allows mixed-case `and`, `or`, and `with`', function () {
86+
var variants = [
87+
'MIT and BSD-3-Clause or GPL-2.0 with GCC-exception-2.0',
88+
'MIT aNd BSD-3-Clause oR GPL-2.0 wITh GCC-exception-2.0',
89+
'MIT AnD BSD-3-Clause Or GPL-2.0 WitH GCC-exception-2.0'
90+
]
91+
var result = {
92+
left: {
93+
left: { license: 'MIT' },
94+
conjunction: 'and',
95+
right: { license: 'BSD-3-Clause' }
96+
},
97+
conjunction: 'or',
98+
right: {
99+
license: 'GPL-2.0',
100+
exception: 'GCC-exception-2.0'
99101
}
100-
)
102+
}
103+
for (let index = 0; index < variants.length; index++) {
104+
const variant = variants[index]
105+
assert.deepStrictEqual(p(variant), result)
106+
}
101107
})
102108

103109
function it (message, test) {

0 commit comments

Comments
 (0)