File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -150,8 +150,8 @@ $(document).ready(function() {
150150
151151// concatenate solution code and test code:
152152function concatSolnTestCode ( solnCode , testCode ) {
153- var filler = ( solnCode [ solnCode . length - 1 ] != '\n' ) ? '\n' : '' ;
154- return solnCode + filler + " \n# Everything below here is test code\n" + testCode ;
153+ // use rtrim to get rid of trailing whitespace and newlines
154+ return solnCode . rtrim ( ) + "\n \n# Everything below here is test code\n" + testCode ;
155155}
156156
157157
@@ -252,7 +252,9 @@ function finishQuestionsInit(questionsDat) {
252252 var numChangedLines = 0 ;
253253
254254 // split on newlines to do a line-level diff
255- var diffResults = diff ( $ ( "#actualCodeInput" ) . val ( ) . split ( / \n / ) , questionsDat . skeleton . split ( / \n / ) ) ;
255+ // (rtrim both strings to discount the effect of trailing
256+ // whitespace and newlines)
257+ var diffResults = diff ( $ ( "#actualCodeInput" ) . val ( ) . rtrim ( ) . split ( / \n / ) , questionsDat . skeleton . rtrim ( ) . split ( / \n / ) ) ;
256258 //console.log(diffResults);
257259 $ . each ( diffResults , function ( i , e ) {
258260 if ( e . file1 && e . file2 ) {
Original file line number Diff line number Diff line change @@ -175,6 +175,7 @@ table#pyCodeOutput .cod {
175175div # editCodeLinkDiv {
176176 text-align : center;
177177 margin-top : 8px ;
178+ margin-bottom : 4px ;
178179}
179180
180181# editCodeLinkOnError {
@@ -205,7 +206,7 @@ button.medBtn {
205206
206207# vcrControls {
207208 margin-top : 10px ;
208- margin-bottom : 20 px ;
209+ margin-bottom : 15 px ;
209210}
210211
211212# vcrControls button {
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ Debug: Mergesort
33
44Question:
55
6- Add at most TWO LINES of code to make the given mergesort function work
6+ Add at most TWO lines of code to make the given mergesort function work
77properly.
88
99Hint:
Original file line number Diff line number Diff line change @@ -4,7 +4,8 @@ Debug: In-place reverse
44Question:
55
66The given function reverses a list in-place, but it doesn't work for all
7- test inputs. Change only ONE line to make this function pass all tests.
7+ test inputs. Change only ONE line of code to make this function pass
8+ all tests.
89
910MaxLineDelta: 1
1011
You can’t perform that action at this time.
0 commit comments