Improve increment and decrement instructions, tests
parent
9e20f4e722
commit
64267ce6c6
|
@ -393,6 +393,7 @@
|
|||
"<code>i++;</code>",
|
||||
"is the equivalent of",
|
||||
"<code>i = i + 1;</code>",
|
||||
"<strong>Note</strong><br>The entire line becomes <code>i++;</code>, eliminating the need for the equal sign.",
|
||||
"<h4>Instructions</h4>",
|
||||
"Change the code to use the <code>++</code> operator on <code>myVar</code>"
|
||||
],
|
||||
|
@ -412,7 +413,7 @@
|
|||
],
|
||||
"tests": [
|
||||
"assert(myVar === 88, 'message: <code>myVar</code> should equal <code>88</code>');",
|
||||
"assert(/[+]{2}/.test(code), 'message: Use the <code>++</code> operator');",
|
||||
"assert(/myVar\\s*[+]{2}/.test(code), 'message: Use the <code>++</code> operator');",
|
||||
"assert(/var myVar = 87;/.test(code), 'message: Do not change code above the line');"
|
||||
],
|
||||
"type": "waypoint",
|
||||
|
@ -431,6 +432,7 @@
|
|||
"<code>i--;</code>",
|
||||
"is the equivalent of",
|
||||
"<code>i = i - 1;</code>",
|
||||
"<strong>Note</strong><br>The entire line becomes <code>i--;</code>, eliminating the need for the equal sign.",
|
||||
"<h4>Instructions</h4>",
|
||||
"Change the code to use the <code>--</code> operator on <code>myVar</code>"
|
||||
],
|
||||
|
@ -450,7 +452,7 @@
|
|||
],
|
||||
"tests": [
|
||||
"assert(myVar === 10, 'message: <code>myVar</code> should equal <code>10</code>');",
|
||||
"assert(/myVar[-]{2}/.test(code), 'message: Use the <code>--</code> operator on <code>myVar</code>');",
|
||||
"assert(/myVar\\s*[-]{2}/.test(code), 'message: Use the <code>--</code> operator on <code>myVar</code>');",
|
||||
"assert(/var myVar = 11;/.test(code), 'message: Do not change code above the line');"
|
||||
],
|
||||
"type": "waypoint",
|
||||
|
|
Loading…
Reference in New Issue