From 84afa33f9752488379c5a2cb90703b70ff4d1820 Mon Sep 17 00:00:00 2001 From: Aldwin Vlasblom Date: Sun, 12 Apr 2020 17:08:42 +0200 Subject: [PATCH] Fix coffeescript support --- lib/doctest.js | 9 +++++---- test/index.js | 36 ++++++++++++++++++------------------ 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/lib/doctest.js b/lib/doctest.js index 02ca1f8e..e20a9135 100644 --- a/lib/doctest.js +++ b/lib/doctest.js @@ -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'); } diff --git a/test/index.js b/test/index.js index b7ba6df2..436d2292 100644 --- a/test/index.js +++ b/test/index.js @@ -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}), @@ -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,