From 32c17317286967cbfff7a1b46e61614b2009874c Mon Sep 17 00:00:00 2001 From: Jan Hecking Date: Tue, 26 Jan 2016 15:08:00 +0800 Subject: [PATCH 1/4] Check that the Spy is doing it's job! --- exercises/function_spies/exercise.js | 8 +++++++- i18n/en.json | 3 ++- i18n/fr.json | 3 ++- i18n/ko.json | 3 ++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/exercises/function_spies/exercise.js b/exercises/function_spies/exercise.js index 4d8bda2..fcbda7a 100644 --- a/exercises/function_spies/exercise.js +++ b/exercises/function_spies/exercise.js @@ -32,7 +32,13 @@ var exercise = module.exports = runner.custom(function(Spy, input) { exercise.emit('fail', exercise.__('incorrect_return')) } }) + count++ + + if (!spy.count || spy.count !== count) { + exercise.emit('fail', exercise.__('incorrect_count')) + } else { + result.push(exercise.__('call_times', spy.count)) + } - result.push(exercise.__('call_times', spy.count)) return result }).quiet(input) diff --git a/i18n/en.json b/i18n/en.json index 6e1f8ee..56ed21c 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -31,7 +31,8 @@ "call_times": "Method called %d times.", "incorrect_return": "Check your function's return value!", "incorrect_this": "Check the function's this! Hint: Function#apply", - "not_all_args": "Check you are passing ALL the arguments! Hint: Function#apply" + "not_all_args": "Check you are passing ALL the arguments! Hint: Function#apply", + "incorrect_count": "Check that your Spy is counting the method invocations correctly!" }, "Trampoline": { "intro": "repeating %d times", diff --git a/i18n/fr.json b/i18n/fr.json index 1c9d769..46ad0b1 100644 --- a/i18n/fr.json +++ b/i18n/fr.json @@ -51,7 +51,8 @@ "call_times": "Méthode appelée %d fois.", "incorrect_return": "Vérifiez la valeur de retour de votre fonction !", "incorrect_this": "Vérifiez le `this` de votre fonction ! Conseil : `Function#apply()`.", - "not_all_args": "Vérifiez que vous transmettez bien TOUS les arguments ! Conseil : `Function#apply()`." + "not_all_args": "Vérifiez que vous transmettez bien TOUS les arguments ! Conseil : `Function#apply()`.", + "incorrect_count": "Vérifiez que votre Spy est compter les appels de méthode correctement!" }, "Trampoline": { "intro": "Répétition de la fonction %d fois", diff --git a/i18n/ko.json b/i18n/ko.json index be433ea..bbcd23b 100644 --- a/i18n/ko.json +++ b/i18n/ko.json @@ -51,7 +51,8 @@ "call_times": "메소드가 %d번 호출되었습니다.", "incorrect_return": "함수의 반환값을 확인하세요!", "incorrect_this": "함수의 this를 확인하세요! 힌트: Function#apply", - "not_all_args": "인자를 모두 넘겼는지 확인하세요! 힌트: Function#apply" + "not_all_args": "인자를 모두 넘겼는지 확인하세요! 힌트: Function#apply", + "incorrect_count": "Check that your Spy is counting the method invocations correctly!" }, "Trampoline": { "intro": "%d번 반복 중", From f16b8ea35247d1081018e2535ed84a55b877a59e Mon Sep 17 00:00:00 2001 From: satanas Date: Tue, 9 Feb 2016 12:09:45 -0300 Subject: [PATCH 2/4] Adjusting boilerplate code for consistency --- exercises/implement_map_with_reduce/problem.fr.md | 6 +++++- exercises/implement_map_with_reduce/problem.ko.md | 4 +++- exercises/implement_map_with_reduce/problem.md | 6 ++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/exercises/implement_map_with_reduce/problem.fr.md b/exercises/implement_map_with_reduce/problem.fr.md index 05e1490..3218108 100644 --- a/exercises/implement_map_with_reduce/problem.fr.md +++ b/exercises/implement_map_with_reduce/problem.fr.md @@ -30,7 +30,11 @@ console.log(output) // => [2,4,6,8,10] ## Base de travail ```js -module.exports = function arrayMap(arr, fn) { + +function arrayMap(arr, fn) { // VOTRE SOLUTION ICI } + +module.exports = arrayMap; + ``` diff --git a/exercises/implement_map_with_reduce/problem.ko.md b/exercises/implement_map_with_reduce/problem.ko.md index 5632fc9..03db1eb 100644 --- a/exercises/implement_map_with_reduce/problem.ko.md +++ b/exercises/implement_map_with_reduce/problem.ko.md @@ -33,9 +33,11 @@ console.log(output) // => [2,4,6,8,10] ```js -module.exports = function arrayMap(arr, fn) { +function arrayMap(arr, fn) { // 여기에 해답을 적으세요 } +module.exports = arrayMap; + ``` diff --git a/exercises/implement_map_with_reduce/problem.md b/exercises/implement_map_with_reduce/problem.md index d6969ae..015030d 100644 --- a/exercises/implement_map_with_reduce/problem.md +++ b/exercises/implement_map_with_reduce/problem.md @@ -37,9 +37,11 @@ console.log(output) // => [2,4,6,8,10] ```js -module.exports = function arrayMap(arr, fn) { - // SOLUTION GOES HERE +function arrayMap(arr, fn) { + //SOLUTION GOES HERE } +module.exports = arrayMap; + ``` From 2ee34dd7713d73155564e7c30e12843ed4118f6d Mon Sep 17 00:00:00 2001 From: Paul McBride Date: Wed, 17 Aug 2016 16:44:09 +0100 Subject: [PATCH 3/4] Correct typo --- Readme.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Readme.md b/Readme.md index be65bed..24471e5 100644 --- a/Readme.md +++ b/Readme.md @@ -48,23 +48,23 @@ will build on skills developed by solving previous problems. #### 2. Writing your solution -Once you have selected a problem, the workshop will remember which problem you are working on. +Once you have selected a problem, the workshop will remember which problem you are working on. Using your preferred editor, simply create a file to write your solution in. Most problems will supply some boilerplate with which to get started. Copy this from the problem description to your solution file. #### 3. Testing your solution -Use the workshop's `run` command to point the workshop at your solution file. Your solution will loaded +Use the workshop's `run` command to point the workshop at your solution file. Your solution will be loaded and passed the problem input. This usually won't perform any validation, it will only show the program output. ``` $ functional-javascript-workshop run mysolution.js ``` - + #### 4. Verifying your solution -Your solution will be verified against the output of the 'official' solution. +Your solution will be verified against the output of the 'official' solution. If all of the output matches, then you have successfully solved the problem! ``` @@ -73,7 +73,7 @@ $ functional-javascript-workshop verify mysolution.js ## Stuck? -Feedback and criticism is welcome, please log your troubles in [issues](https://github.com/timoxley/functional-javascript-workshop/issues). +Feedback and criticism is welcome, please log your troubles in [issues](https://github.com/timoxley/functional-javascript-workshop/issues). Full curriculum reviews [like this one](https://github.com/timoxley/functional-javascript-workshop/issues/7) are incredibly helpful. More feedback like this please! @@ -87,7 +87,7 @@ We're looking for more practical problems, so if you come across a problem in yo ## Resources -[A growing collection of quality functional javascript resources can be found in the wiki](https://github.com/timoxley/functional-javascript-workshop/wiki). +[A growing collection of quality functional javascript resources can be found in the wiki](https://github.com/timoxley/functional-javascript-workshop/wiki). ## Thanks rvagg From 8d5190924c53e5cc4664adbabe6845512e3d8597 Mon Sep 17 00:00:00 2001 From: Tim Oxley Date: Thu, 25 Aug 2016 22:45:03 +1000 Subject: [PATCH 4/4] Release 1.0.6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4684f36..253ed12 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "functional-javascript-workshop", - "version": "1.0.5", + "version": "1.0.6", "description": "The basics of functional programming in JavaScript. No libraries required.", "main": "index.js", "bin": {