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
pull/18182/head
Strahinja Mitrovic 2018-08-21 17:46:37 +02:00 committed by Kristofer Koishigawa
parent 6058da3725
commit cb21e59f7a
1 changed files with 6 additions and 0 deletions

View File

@ -5066,6 +5066,12 @@
"testString":
"assert(code.match(/if/g).length > 1, 'You should have at least two <code>if</code> 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": "<code>testElseIf(0)</code> should return \"Smaller than 5\"",
"testString":