From aa65a45e1c182f914a0efc784248f5d79224b1fb Mon Sep 17 00:00:00 2001 From: Tom DeFrank Date: Fri, 8 Apr 2016 13:16:49 -0400 Subject: [PATCH] closure lesson fix for returning on the same line as zip() declaration --- exercises/closures/index.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/exercises/closures/index.js b/exercises/closures/index.js index 7b83f03..042e36e 100644 --- a/exercises/closures/index.js +++ b/exercises/closures/index.js @@ -15,15 +15,23 @@ module.exports = { scopeAsAscii = asciiScope(code); - t.equal( - scopeAsAscii, - ['(global)','\tfoo()','\t- var bar','\t- quux = ?','\treturn zip','\t\tzip()','\t\t- var quux', '\t\t- bar = ?'].join('\n'), - 'The structure is correct' - ); + if (scopeAsAscii.match(/return/)){ + t.equal( + scopeAsAscii, + ['(global)','\tfoo()','\t- var bar','\t- quux = ?','\treturn zip','\t\tzip()','\t\t- var quux', '\t\t- bar = ?'].join('\n'), + 'The structure is correct' + ); + } else { + t.equal( + scopeAsAscii, + ['(global)','\tfoo()','\t- var bar','\t- quux = ?','\t\tzip()','\t\t- var quux', '\t\t- bar = ?'].join('\n'), + 'The structure is correct' + ); + } t.end(); }); }) -} +} \ No newline at end of file