Skip to content

Commit 03050a3

Browse files
committed
Fix tests file line parsing
1 parent 6a52e29 commit 03050a3

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

test/test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,19 @@ function testVersions([input, type], expected) {
3434
function testPackFormats() {
3535
const formatsTests = fs.readFileSync(path.join(__dirname, 'pack-formats-tests.txt'), { 'encoding': 'utf-8' })
3636
for (const line of formatsTests.split('\n')) {
37-
const parts = line.match(/^"(.*)" \((r|d|r,d|-)\) (\w+|\w+,\w+)/)
37+
const parts = line.match(/^"(.*)" \((r|d|r,d|-)\) (\w+(?:,\w+)?)/)
3838
if (!parts)
3939
continue
4040

4141
const getAns = ans => ans === 'none' ? undefined : ans === 'null' ? null : +ans
4242
const [, lineName, lineType, lineAns] = parts
4343
const input = lineName || "[blank]"
44-
const type = { 'r': 'resource', 'd': 'data', 'b': 'both', '-': undefined }[lineType]
44+
const type = { 'r': 'resource', 'd': 'data', 'r,d': 'both', '-': undefined }[lineType]
4545
if (type === 'both') {
4646
// multiple: data AND resource
4747
const [resourceAns, dataAns] = lineAns.split(',')
48-
testPackFormat(input, type, getAns(resourceAns))
49-
testPackFormat(input, type, getAns(dataAns))
48+
testPackFormat(input, 'resource', getAns(resourceAns))
49+
testPackFormat(input, 'data', getAns(dataAns))
5050
}
5151
else {
5252
// either data OR resource

0 commit comments

Comments
 (0)