@@ -13,6 +13,7 @@ import { ExtensionConfigurationSettings, ConfigurationReader } from '../../src/c
1313import { platformPathEquivalent , resolvePath } from '@cmt/util' ;
1414import { CMakeOutputConsumer } from '@cmt/diagnostics/cmake' ;
1515import { populateCollection } from '@cmt/diagnostics/util' ;
16+ import collections from '@cmt/diagnostics/collections' ;
1617import { getTestResourceFilePath } from '@test/util' ;
1718
1819function feedLines ( consumer : OutputConsumer , output : string [ ] , error : string [ ] ) {
@@ -975,4 +976,32 @@ suite('Diagnostics', () => {
975976 expect ( all2 . message ) . to . eq ( 'The full include-list:\n#include "array.h" // for ARRAY_SIZE' ) ;
976977 expect ( all2 . severity ) . to . eq ( 'note' ) ;
977978 } ) ;
979+
980+ test ( 'clearAll clears all diagnostic collections' , ( ) => {
981+ // Add some diagnostics to each collection
982+ const testUri = vscode . Uri . file ( '/test/file.cpp' ) ;
983+ const testDiagnostic = new vscode . Diagnostic (
984+ new vscode . Range ( 0 , 0 , 0 , 10 ) ,
985+ 'Test diagnostic' ,
986+ vscode . DiagnosticSeverity . Error
987+ ) ;
988+
989+ // Populate the collections
990+ collections . cmake . set ( testUri , [ testDiagnostic ] ) ;
991+ collections . build . set ( testUri , [ testDiagnostic ] ) ;
992+ collections . presets . set ( testUri , [ testDiagnostic ] ) ;
993+
994+ // Verify diagnostics were added
995+ expect ( collections . cmake . has ( testUri ) ) . to . be . true ;
996+ expect ( collections . build . has ( testUri ) ) . to . be . true ;
997+ expect ( collections . presets . has ( testUri ) ) . to . be . true ;
998+
999+ // Clear all collections
1000+ collections . clearAll ( ) ;
1001+
1002+ // Verify all collections are cleared
1003+ expect ( collections . cmake . has ( testUri ) ) . to . be . false ;
1004+ expect ( collections . build . has ( testUri ) ) . to . be . false ;
1005+ expect ( collections . presets . has ( testUri ) ) . to . be . false ;
1006+ } ) ;
9781007} ) ;
0 commit comments