From 43cd4a59d7729c06e84b8ee71babef80ca52b04c Mon Sep 17 00:00:00 2001 From: Billy Reilly Date: Fri, 3 Feb 2017 09:54:01 +0000 Subject: [PATCH] fix(challenges): Additional test cases for 'Escape Sequences in Strings' --- .../basic-javascript.json | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/seed/challenges/02-javascript-algorithms-and-data-structures/basic-javascript.json b/seed/challenges/02-javascript-algorithms-and-data-structures/basic-javascript.json index 45e9f02551023d..dcce43be5bcbc8 100755 --- a/seed/challenges/02-javascript-algorithms-and-data-structures/basic-javascript.json +++ b/seed/challenges/02-javascript-algorithms-and-data-structures/basic-javascript.json @@ -1180,10 +1180,12 @@ "var myStr = \"FirstLine\\n\\t\\\\SecondLine\\nThirdLine\";" ], "tests": [ - "assert(myStr === \"FirstLine\\n\\t\\\\SecondLine\\nThirdLine\", 'message: myStr should have encoded text with the proper escape sequences and no spacing.');", - "assert(myStr.match(/\\n/g).length == 2, 'message: myStr should have two newline characters \\n');", - "assert(myStr.match(/\\t/g).length == 1, 'message: myStr should have one tab character \\t');", - "assert(myStr.match(/\\\\/g).length == 1, 'message: myStr should have one correctly escaped backslash character \\\\');" + "assert(!/ /.test(myStr), 'message: myStr should not contain any spaces');", + "assert(/FirstLine/.test(myStr) && /SecondLine/.test(myStr) && /ThirdLine/.test(myStr), 'message: myStr should contain the strings FirstLine, SecondLine and ThirdLine (remember case sensitivity)');", + "assert(/FirstLine\\n/.test(myStr), 'message: FirstLine should be followed by the newline character \\n');", + "assert(/\\n\\t/.test(myStr), 'message: myStr should contain a tab character \\t which follows a newline character');", + "assert(/\\SecondLine/.test(myStr), 'message: SecondLine should be preceded by the backslash character \\\\');", + "assert(/SecondLine\\nThirdLine/.test(myStr), 'message: There should be a newline character between SecondLine and ThirdLine');" ], "type": "waypoint", "challengeType": 1,