use a regexp to make sure user only changes the first line

This commit is contained in:
jools
2017-04-24 21:28:46 +02:00
parent 624da2c6ab
commit bd944478bd

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,