Merge pull request #14579 from JoolsMcFly/fix/add-regexp-to-better-validate-user-code

use a regexp to make sure user only changes the first line
This commit is contained in:
Dylan 2017-05-04 07:39:50 -05:00 committed by GitHub
commit 4202e9f5f9

View File

@ -393,8 +393,7 @@
],
"tests": [
"assert(difference === 12, 'message: Make the variable <code>difference</code> equal 12.');",
"assert((code).match(/difference/g).length === 1,'message: Only change the first line');",
"assert(/\\d+\\s*-\\s*\\d+/.test(code),'message: Use the <code>-</code> operator');"
"assert(/var\\s*difference\\s*=\\s*45\\s*-\\s*33;?/.test(code),'message: Only subtract one number from 45.');"
],
"type": "waypoint",
"challengeType": 1,