@@ -13,14 +13,21 @@ function createTempFile () {
1313 return tempFile
1414}
1515
16+ async function restoreProjectConfig ( ) {
17+ log . info ( 'restoring openedge-project.json file' )
18+ FileUtils . copyFile ( backupProjectFile , 'openedge-project.json' , { preserveTimestamps : true } )
19+ await deleteRcode ( )
20+ await restartLangServer ( 32 )
21+ }
22+
1623const backupProjectFile = 'oeproject.bk'
1724const disposables : vscode . Disposable [ ] = [ ]
1825let firstSetup = true
1926let ext : Extension < ABLUnitTestRunner >
2027
2128suiteSetup ( 'proj0 - before' , async ( ) => {
2229 FileUtils . copyFile ( '.vscode/settings.json' , '.vscode/settings.json.bk' )
23- FileUtils . copyFile ( 'openedge-project.json' , backupProjectFile )
30+ FileUtils . copyFile ( 'openedge-project.json' , backupProjectFile , { preserveTimestamps : true } )
2431
2532 FileUtils . deleteDir ( toUri ( 'd1' ) )
2633 FileUtils . deleteDir ( toUri ( 'd2' ) )
@@ -47,8 +54,12 @@ suiteSetup('proj0 - before', async () => {
4754} )
4855
4956setup ( 'proj0 - setup' , async ( ) => {
57+ log . info ( '---------- setup ----------' )
5058 FileUtils . copyFile ( '.vscode/settings.json.bk' , '.vscode/settings.json' )
51- FileUtils . copyFile ( backupProjectFile , 'openedge-project.json' )
59+ if ( FileUtils . getFileModifiedTime ( backupProjectFile ) . valueOf ( ) !== FileUtils . getFileModifiedTime ( 'openedge-project.json' ) . valueOf ( ) ) {
60+ await restoreProjectConfig ( )
61+ }
62+ await commands . executeCommand ( 'workbench.action.closeAllEditors' )
5263
5364 if ( firstSetup ) {
5465 const oever = process . env [ 'ABLUNIT_TEST_RUNNER_OE_VERSION' ] ?? process . env [ 'OE_VERSION' ]
@@ -57,10 +68,11 @@ setup('proj0 - setup', async () => {
5768 }
5869 firstSetup = false
5970 }
71+ log . info ( '---------- setup complete ----------' )
6072} )
6173
6274teardown ( 'proj0 - afterEach' , ( ) => {
63- log . info ( 'proj0 teardown' )
75+ log . info ( '---------- teardown start ---------- ' )
6476 FileUtils . deleteFile ( [
6577 toUri ( '.vscode/ablunit-test-profile.json' ) ,
6678 toUri ( 'results.json' ) ,
@@ -77,6 +89,8 @@ teardown('proj0 - afterEach', () => {
7789 log . warn ( 'disposables.length != 0' )
7890 }
7991 }
92+
93+ log . info ( '---------- teardown complete ----------' )
8094} )
8195
8296suiteTeardown ( 'proj0 - after' , ( ) => {
@@ -303,11 +317,6 @@ test('proj0.11 - timeout 5s', () => {
303317test ( 'proj0.12 - timeout 1500ms fail' , ( ) => {
304318 log . info ( '---------- proj0.12 ----------' )
305319 const prom = updateConfig ( 'ablunit.files.exclude' , '**/.{builder,pct}/**' )
306- . then ( ( ) => {
307- const cfg = workspace . getConfiguration ( 'ablunit.files.exclude' )
308- log . debug ( 'files.exclude=' + JSON . stringify ( cfg ) )
309- return
310- } )
311320 . then ( ( ) => { return updateTestProfile ( 'timeout' , 1500 ) } )
312321 . then ( ( ) => { return runTestAtLine ( 'src/timeout.p' , 37 , 0 ) } )
313322 . then ( ( ) => { return commands . executeCommand ( '_ablunit.getTestRunError' ) } )
@@ -361,8 +370,30 @@ test('proj0.14 - timeout invalid -5s', async () => {
361370 return
362371} )
363372
373+ test ( 'proj0.15 - european numbers (-E)' , ( ) => {
374+ log . info ( '---------- proj0.15 -----------' )
375+ FileUtils . copyFile ( 'openedge-project.test15.json' , 'openedge-project.json' )
376+
377+ const prom = updateConfig ( 'ablunit.files.exclude' , '**/.{builder,pct}/**' )
378+ . then ( ( ) => sleep ( 100 ) )
379+ . then ( ( ) => runTestAtLine ( 'src/timeout.p' , 37 , 0 ) )
380+ . then ( ( ) => getResults ( ) )
381+ . then ( ( recentResults ) => {
382+ const resultsXml = FileUtils . readFileSync ( toUri ( 'results.xml' ) ) . toString ( )
383+ log . info ( 'resultsXml=' + resultsXml )
384+ const time = resultsXml . search ( / t i m e = " [ \d ] + , [ \d ] + " / )
385+ assert . ok ( time > 0 , 'could not find time attribute with european number format in results.xml' )
386+ assert . ok ( ! isNaN ( Number ( recentResults [ 0 ] . ablResults ?. resultsJson [ 0 ] . testsuite ?. [ 0 ] . time ) ) , 'testsuite time should not be NaN due to european number format' )
387+ assert . ok ( ! isNaN ( Number ( recentResults [ 0 ] . ablResults ?. resultsJson [ 0 ] . testsuite ?. [ 0 ] . testcases ?. [ 0 ] . time ) ) , 'testcase time should not be NaN due to european number format' )
388+ return true
389+ } , ( e : unknown ) => {
390+ assert . fail ( 'unexpected test error (e=' + e + ')' )
391+ } )
392+ return prom
393+ } )
394+
364395test ( 'proj0.17 - coverage in class property getters/setters' , async ( ) => {
365- log . info ( 'proj0.17' )
396+ log . info ( '---------- proj0.17 ---------- ' )
366397 FileUtils . deleteFile ( [ 'results.xml' , 'results.json' ] , { force : true } )
367398 FileUtils . copyFile ( '.vscode/ablunit-test-profile.proj0.17.json' , '.vscode/ablunit-test-profile.json' )
368399 await runTestAtLine ( 'src/test_17.cls' , 33 , 1 , TestRunProfileKind . Coverage )
@@ -436,7 +467,7 @@ test('proj0.19 - program runs external source', async () => {
436467test ( 'proj0.20 - build directory' , async ( ) => {
437468 FileUtils . copyFile ( 'openedge-project.test20.json' , 'openedge-project.json' )
438469 await deleteRcode ( )
439- await restartLangServer ( 23 )
470+ await restartLangServer ( 32 )
440471
441472 assert . fileExists ( 'd1/test_20.r' )
442473 assert . fileExists ( 'd2/test_20.p.xref' )
@@ -446,10 +477,6 @@ test('proj0.20 - build directory', async () => {
446477 assert . tests . count ( 1 )
447478 assert . coverageProcessingMethod ( toUri ( 'src/test_20.p' ) , 'rcode' )
448479 } )
449-
450- FileUtils . copyFile ( backupProjectFile , 'openedge-project.json' )
451- await deleteRcode ( )
452- await restartLangServer ( 23 )
453480} )
454481
455482test ( 'proj0.21 - overloaded method coverage' , async ( ) => {
0 commit comments