@@ -5,6 +5,7 @@ import { getProjectFile, getObjectDir } from '../../../src/helpers';
55import { assertEqualToFileContent , activate } from '../utils' ;
66
77import * as vscode from 'vscode' ;
8+ import { readFileSync , writeFileSync } from 'fs' ;
89
910suite ( 'Extensions Test Suite' , function ( ) {
1011 // Make sure the extension is activated
@@ -38,6 +39,7 @@ suite('Extensions Test Suite', function () {
3839 ] ;
3940 const folder = vscode . workspace . workspaceFolders [ 0 ] . uri ;
4041 const fileUri = vscode . Uri . joinPath ( folder , 'src' , 'test_subprogram_box.adb' ) ;
42+ const contentBefore = readFileSync ( fileUri . fsPath ) ;
4143 const expectedUri = vscode . Uri . joinPath ( folder , 'src' , 'test_subprogram_box.expected' ) ;
4244
4345 for ( const cursorPos of cursorPositions ) {
@@ -47,8 +49,16 @@ suite('Extensions Test Suite', function () {
4749 await vscode . commands . executeCommand ( 'ada.subprogramBox' ) ;
4850 }
4951 const editorText = vscode . window . activeTextEditor ?. document . getText ( ) ?? '' ;
52+ vscode . window . activeTextEditor ?. hide ( ) ;
5053
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+ }
5262 } else {
5363 throw new Error ( 'No workspace folder found for the specified URI' ) ;
5464 }
0 commit comments