From cb21e59f7ae7c5e897305cbf72e0903ee815e9d4 Mon Sep 17 00:00:00 2001 From: Strahinja Mitrovic Date: Tue, 21 Aug 2018 17:46:37 +0200 Subject: [PATCH] fix(challenges): fix #17155 i've added a test for if else statements curly braces to ensure that every condition has to have both opening and closing curly braces. I've also made changes that were by scissorsneedfood. ISSUES CLOSED: #17155 --- .../basic-javascript.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/challenges/02-javascript-algorithms-and-data-structures/basic-javascript.json b/challenges/02-javascript-algorithms-and-data-structures/basic-javascript.json index 2b788e751..bdfaf51c2 100644 --- a/challenges/02-javascript-algorithms-and-data-structures/basic-javascript.json +++ b/challenges/02-javascript-algorithms-and-data-structures/basic-javascript.json @@ -5066,6 +5066,12 @@ "testString": "assert(code.match(/if/g).length > 1, 'You should have at least two if statements');" }, + { + "text": + "You should have closing and opening curly braces for each condition", + "testString": + "assert(code.match(/if\\s*\\((.+)\\)\\s*\\{[\\s\\S]+\\}\\s*else if\\s*\\((.+)\\)\\s*\\{[\\s\\S]+\\}\\s*else\\s*\\{[\\s\\S]+\\s*\\}/), 'You should have closing and opening curly braces for each condition in your if else statement');" + }, { "text": "testElseIf(0) should return \"Smaller than 5\"", "testString":