From 49b9c8c9c84eccd1c00dff0cf379c62d74d6bae9 Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Mon, 28 Dec 2015 23:14:42 -0800 Subject: [PATCH] Fix head/tail are arrays --- seed/test-challenges.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/seed/test-challenges.js b/seed/test-challenges.js index 5e5f1f444d..71198d83ab 100644 --- a/seed/test-challenges.js +++ b/seed/test-challenges.js @@ -55,11 +55,13 @@ function createTest({ title, tests = [], solutions = [], - head = '', - tail = '' + head = [], + tail = [] }) { solutions = solutions.filter(solution => !!solution); tests = tests.filter(test => !!test); + head = head.join('\n'); + tail = tail.join('\n'); const plan = tests.length; if (!plan) { return Observable.just({ @@ -87,11 +89,13 @@ function createTest({ .doOnNext(assert => { solutions.forEach(solution => { tests.forEach(test => { - const code = head + solution + tail; + const code = solution; const editor = { getValue() { return code; } }; /* eslint-enable no-unused-vars */ try { - (() => { return eval(solution + ';;' + test); })(); + (() => { + return eval(head + solution + tail + ';;' + test); + })(); } catch (e) { t.fail(e); }