@@ -182,16 +182,19 @@ function setCustomTestcaseResults(results) {
182
182
if ( ! validateResults ( results ) ) {
183
183
return ;
184
184
}
185
+
186
+ document . getElementById ( 'testcase-stderr' ) . textContent = results . stderr ;
185
187
186
188
if ( results . tests . length !== 1 ) {
187
189
console . error ( "Expected 1 custom test results, got " +
188
190
results . tests . length ) ;
189
- return ;
191
+ return ;
190
192
}
191
193
192
194
if ( results . tests [ 0 ] . status !== "Skipped" ) {
193
195
console . error ( "Expected custom test status to be 'skipped', got " +
194
196
results . tests [ 0 ] . status ) ;
197
+ return ;
195
198
}
196
199
197
200
console . log ( "Setting custom testcase results: " + JSON . stringify ( results ) ) ;
@@ -202,6 +205,8 @@ function setCustomTestcaseResults(results) {
202
205
203
206
run ( setExpectedTestcaseResults , directoryManager . getCustomTestcaseName ( ) ,
204
207
true ) ;
208
+
209
+ document . getElementById ( 'tab-testcases' ) . click ( ) ;
205
210
}
206
211
207
212
function setExpectedTestcaseResults ( expected ) {
@@ -227,6 +232,12 @@ function setExpectedTestcaseResults(expected) {
227
232
function runCustomTestcase ( ) {
228
233
console . log ( "Running custom testcase for " + activeProblem ) ;
229
234
235
+ document . getElementById ( 'testcase-stdout' ) . textContent = "" ;
236
+ document . getElementById ( 'testcase-stderr' ) . textContent = "" ;
237
+ document . getElementById ( 'testcase-output' ) . textContent = "" ;
238
+ document . getElementById ( 'compilation-content' ) . textContent = "" ;
239
+ document . getElementById ( 'test-results-content' ) . innerHTML = "" ;
240
+
230
241
const input = document . getElementById ( 'input-container' ) . value + "\n*" ;
231
242
const customTestcaseFilename =
232
243
directoryManager . getCustomTestcaseFilename ( activeProblem ) ;
@@ -266,6 +277,10 @@ function setUserSolution(problemName) {
266
277
267
278
var previousProblem ;
268
279
function onProblemSelected ( problemName ) {
280
+ document . getElementById ( 'testcase-stdout' ) . textContent = "" ;
281
+ document . getElementById ( 'testcase-stderr' ) . textContent = "" ;
282
+ document . getElementById ( 'testcase-output' ) . textContent = "" ;
283
+
269
284
saveSolution ( 'cpp' , editor . getValue ( ) ) ;
270
285
previousProblem = problemName ;
271
286
@@ -306,12 +321,16 @@ function initializeSaveCommand() {
306
321
function initializeRunCommand ( ) {
307
322
ipcRenderer . on ( 'run-command' , ( ) => {
308
323
console . log ( 'Received run command' ) ;
324
+ document . getElementById ( 'compilation-content' ) . textContent = "" ;
325
+ document . getElementById ( 'test-results-content' ) . innerHTML = "" ;
309
326
run ( setTestResults ) ;
310
327
} ) ;
311
328
312
329
document . getElementById ( 'run-button' )
313
330
. addEventListener ( 'click' , function ( ) {
314
331
console . log ( 'Run button clicked' ) ;
332
+ document . getElementById ( 'compilation-content' ) . textContent = "" ;
333
+ document . getElementById ( 'test-results-content' ) . innerHTML = "" ;
315
334
run ( setTestResults ) ;
316
335
} ) ;
317
336
}
0 commit comments