File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -147,11 +147,6 @@ function addTestcase(initialCod /* optional code to pre-seed this test */) {
147147 te . setFontSize ( 11 ) ;
148148 //te.setReadOnly(true);
149149
150- if ( initialCod ) {
151- te . setValue ( initialCod . rtrim ( ) /* kill trailing spaces */ ,
152- - 1 /* do NOT select after setting text */ ) ;
153- }
154-
155150 var s = te . getSession ( ) ;
156151 s . setTabSize ( 2 ) ;
157152 s . setUseSoftTabs ( true ) ;
@@ -164,17 +159,24 @@ function addTestcase(initialCod /* optional code to pre-seed this test */) {
164159 // TODO: change syntax highlighting mode if the user changes languages:
165160 var lang = $ ( '#pythonVersionSelector' ) . val ( ) ;
166161 var mod = 'python' ;
162+ var defaultVal = '\n# assert <test condition>' ;
167163 if ( lang === 'java' ) {
168164 mod = 'java' ;
165+ defaultVal = '// sorry, Java tests not yet supported' ;
169166 } else if ( lang === 'js' ) {
170167 mod = 'javascript' ;
168+ defaultVal = '\n// console.assert(<test condition>);' ;
171169 } else if ( lang === 'ts' ) {
172170 mod = 'typescript' ;
171+ defaultVal = '\n// console.assert(<test condition>);' ;
173172 } else if ( lang === 'ruby' ) {
174173 mod = 'ruby' ;
174+ defaultVal = "\n# raise 'fail' unless <test condition>" ;
175175 }
176176 s . setMode ( "ace/mode/" + mod ) ;
177177
178+ te . setValue ( initialCod ? initialCod . rtrim ( ) : defaultVal ,
179+ - 1 /* do NOT select after setting text */ ) ;
178180
179181 function runOrVizTestCase ( isViz /* true for visualize, false for run */ ) {
180182 if ( isViz ) {
You can’t perform that action at this time.
0 commit comments