Skip to content

Commit 467b433

Browse files
committed
yay
1 parent f482e87 commit 467b433

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

‎v3/js/opt-testcases.js‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,25 @@ function getCombinedCode(id) {
7272
// for reporting syntax errors separately for user and test code
7373
var userCodNumLines = userCod.split('\n').length;
7474

75-
var bufferCod = '\n\n### Test code ###\n';
75+
var lang = $('#pythonVersionSelector').val();
76+
if (lang === 'ts' || lang === 'js' || lang === 'java') {
77+
var bufferCod = '\n\n// Test code //\n';
78+
} else {
79+
var bufferCod = '\n\n## Test code ##\n';
80+
}
81+
7682
var bufferCodNumLines = bufferCod.split('\n').length;
7783

7884
var combinedCod = userCod + bufferCod + testCod;
7985
return {cod: combinedCod,
8086
firstTestLine: userCodNumLines + bufferCodNumLines - 1};
8187
}
8288

83-
function startRunningTest() {
89+
function startRunningTest(id) {
8490
$("#runAllTestsButton,.runTestCase,.vizTestCase").attr('disabled', true);
91+
var e = ace.edit('testCaseEditor_' + id);
92+
e.getSession().clearAnnotations();
93+
$('#outputTd_' + id).html('');
8594
}
8695

8796
function doneRunningTest() {
@@ -153,7 +162,7 @@ function addTestcase(id) {
153162

154163
$('#runTestCase_' + id).click(function() {
155164
$(this).html("Running ...");
156-
startRunningTest();
165+
startRunningTest(id);
157166
var dat = getCombinedCode(id);
158167
console.log(dat.cod);
159168
console.log(dat.firstTestLine);
@@ -168,7 +177,7 @@ function addTestcase(id) {
168177

169178
$('#vizTestCase_' + id).click(function() {
170179
$(this).html("Visualizing ...");
171-
startRunningTest();
180+
startRunningTest(id);
172181
var dat = getCombinedCode(id);
173182
console.log(dat.cod);
174183
console.log(dat.firstTestLine);

0 commit comments

Comments
 (0)