@@ -5,6 +5,7 @@ import { getProjectFile, getObjectDir } from '../../../src/helpers';
5
5
import { assertEqualToFileContent , activate } from '../utils' ;
6
6
7
7
import * as vscode from 'vscode' ;
8
+ import { readFileSync , writeFileSync } from 'fs' ;
8
9
9
10
suite ( 'Extensions Test Suite' , function ( ) {
10
11
// Make sure the extension is activated
@@ -38,6 +39,7 @@ suite('Extensions Test Suite', function () {
38
39
] ;
39
40
const folder = vscode . workspace . workspaceFolders [ 0 ] . uri ;
40
41
const fileUri = vscode . Uri . joinPath ( folder , 'src' , 'test_subprogram_box.adb' ) ;
42
+ const contentBefore = readFileSync ( fileUri . fsPath ) ;
41
43
const expectedUri = vscode . Uri . joinPath ( folder , 'src' , 'test_subprogram_box.expected' ) ;
42
44
43
45
for ( const cursorPos of cursorPositions ) {
@@ -47,8 +49,16 @@ suite('Extensions Test Suite', function () {
47
49
await vscode . commands . executeCommand ( 'ada.subprogramBox' ) ;
48
50
}
49
51
const editorText = vscode . window . activeTextEditor ?. document . getText ( ) ?? '' ;
52
+ vscode . window . activeTextEditor ?. hide ( ) ;
50
53
51
- assertEqualToFileContent ( editorText , expectedUri ) ;
54
+ try {
55
+ assertEqualToFileContent ( editorText , expectedUri ) ;
56
+ } finally {
57
+ /**
58
+ * Restore the old file content
59
+ */
60
+ writeFileSync ( fileUri . fsPath , contentBefore ) ;
61
+ }
52
62
} else {
53
63
throw new Error ( 'No workspace folder found for the specified URI' ) ;
54
64
}
0 commit comments