Skip to content

Commit c31b66d

Browse files
committed
yay
1 parent f9cab47 commit c31b66d

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

523 Bytes
Loading

‎v5-unity/js/opt-frontend.ts‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,7 @@ class OptFrontendWithTestcases extends OptFrontend {
820820
this.optTests.appStateAugmenter(appState);
821821
}
822822

823-
runTestCase(id, codeToExec) {
823+
runTestCase(id, codeToExec, firstTestLine) {
824824
// adapted from executeCode in opt-frontend.js
825825
var backendOptionsObj = this.getBaseBackendOptionsObj();
826826
var frontendOptionsObj = this.getBaseFrontendOptionsObj();
@@ -837,8 +837,8 @@ class OptFrontendWithTestcases extends OptFrontend {
837837
// highlight the faulting line in the test case pane itself
838838
if (errorLineNo !== undefined &&
839839
errorLineNo != NaN &&
840-
errorLineNo >= dat.firstTestLine) {
841-
var adjustedErrorLineNo = errorLineNo - dat.firstTestLine;
840+
errorLineNo >= firstTestLine) {
841+
var adjustedErrorLineNo = errorLineNo - firstTestLine;
842842

843843
var te = ace.edit('testCaseEditor_' + id);
844844
var s = te.getSession();
@@ -884,7 +884,10 @@ class OptFrontendWithTestcases extends OptFrontend {
884884
runTestCaseCallback.bind(this));
885885
}
886886

887-
vizTestCase(id, codeToExec) {
887+
// TODO: properly handle and display errors when there's a syntax
888+
// error ... right now it displays as a syntax error in the main pane,
889+
// which can be confusing
890+
vizTestCase(id, codeToExec, firstTestLine) {
888891
// adapted from executeCode in opt-frontend.js
889892
var backendOptionsObj = this.getBaseBackendOptionsObj();
890893
var frontendOptionsObj = this.getBaseFrontendOptionsObj();
@@ -1050,14 +1053,13 @@ class OptTestcases {
10501053

10511054
var dat = _me.getCombinedCode(id);
10521055
var cod = dat.cod;
1053-
var firstTestLine = dat.firstTestLine; // TODO: use me later
10541056

10551057
if (isViz) {
10561058
$('#vizTestCase_' + id).html("Visualizing ...");
1057-
_me.parent.vizTestCase(id, cod);
1059+
_me.parent.vizTestCase(id, cod, dat.firstTestLine);
10581060
} else {
10591061
$('#runTestCase_' + id).html("Running ...");
1060-
_me.parent.runTestCase(id, cod);
1062+
_me.parent.runTestCase(id, cod, dat.firstTestLine);
10611063
}
10621064
}
10631065

0 commit comments

Comments
 (0)