Skip to content

Commit

Permalink
Fix coffeescript support
Browse files Browse the repository at this point in the history
  • Loading branch information
Avaq committed Apr 12, 2020
1 parent c319655 commit 84afa33
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 22 deletions.
9 changes: 5 additions & 4 deletions lib/doctest.js
Original file line number Diff line number Diff line change
Expand Up @@ -383,11 +383,12 @@ function wrap$coffee(test) {
' type: "' + OUTPUT + '"',
' ":": ' + test[OUTPUT].loc.start.line,
' "!": ' + test['!'],
' thunk: ->',
' thunk: -> [',
indentN (4, test[OUTPUT].values.map (function(out) {
// TODO: Inject output into Coffeescript
return '';
}).join (',')),
return '{channel: ' + JSON.stringify (out.channel) +
', value: (\n' + indentN (6, out.value) + '\n )}';
}).join ('\n')),
' ]',
'}'
]).join ('\n');
}
Expand Down
36 changes: 18 additions & 18 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,18 @@ function testCommand(command, expected) {

const moduleTests = Promise.all ([
testModule ('test/shared/index.js', {silent: true}),
// testModule ('test/shared/index.coffee', {silent: true}),
testModule ('test/shared/index.coffee', {silent: true}),
testModule ('test/line-endings/CR.js', {silent: true}),
// testModule ('test/line-endings/CR.coffee', {silent: true}),
testModule ('test/line-endings/CR.coffee', {silent: true}),
testModule ('test/line-endings/CR+LF.js', {silent: true}),
// testModule ('test/line-endings/CR+LF.coffee', {silent: true}),
testModule ('test/line-endings/CR+LF.coffee', {silent: true}),
testModule ('test/line-endings/LF.js', {silent: true}),
// testModule ('test/line-endings/LF.coffee', {silent: true}),
testModule ('test/line-endings/LF.coffee', {silent: true}),
testModule ('test/exceptions/index.js', {silent: true}),
testModule ('test/statements/index.js', {silent: true}),
testModule ('test/fantasy-land/index.js', {silent: true}),
testModule ('test/transcribe/index.js', {prefix: '.', openingDelimiter: '```javascript', closingDelimiter: '```', silent: true}),
// testModule ('test/transcribe/index.coffee', {prefix: '.', openingDelimiter: '```coffee', closingDelimiter: '```', silent: true}),
testModule ('test/transcribe/index.coffee', {prefix: '.', openingDelimiter: '```coffee', closingDelimiter: '```', silent: true}),
testModule ('test/amd/index.js', {module: 'amd', silent: true}),
testModule ('test/commonjs/require/index.js', {module: 'commonjs', silent: true}),
testModule ('test/commonjs/exports/index.js', {module: 'commonjs', silent: true}),
Expand Down Expand Up @@ -144,19 +144,19 @@ testCommand ('bin/doctest test/shared/index.js', {
stderr: ''
});

// testCommand ('bin/doctest test/shared/index.coffee', {
// status: 1,
// stdout: unlines ([
// 'running doctests in test/shared/index.coffee...',
// '......x.x...........x........x',
// 'FAIL: expected 5 on line 31 (got 4)',
// 'FAIL: expected ! TypeError on line 38 (got 0)',
// 'FAIL: expected 9.5 on line 97 (got 5)',
// 'FAIL: expected "on automatic semicolon insertion" on line 155 ' +
// '(got "the rewriter should not rely")'
// ]),
// stderr: ''
// });
testCommand ('bin/doctest test/shared/index.coffee', {
status: 1,
stdout: unlines ([
'running doctests in test/shared/index.coffee...',
'......x.x...........x........x',
'FAIL: expected 5 on line 31 (got 4)',
'FAIL: expected ! TypeError on line 38 (got 0)',
'FAIL: expected 9.5 on line 97 (got 5)',
'FAIL: expected "on automatic semicolon insertion" on line 155 ' +
'(got "the rewriter should not rely")'
]),
stderr: ''
});

// testCommand ('bin/doctest test/shared/index.js test/shared/index.coffee', {
// status: 1,
Expand Down

0 comments on commit 84afa33

Please sign in to comment.