@@ -862,6 +862,49 @@ suite('Map', () => {
862
862
}
863
863
} ) ;
864
864
865
+ test ( 'TernarySearchTree: Cannot read properties of undefined (reading \'length\'): #161618 (simple)' , function ( ) {
866
+ const raw = 'config.debug.toolBarLocation,floating,config.editor.renderControlCharacters,true,config.editor.renderWhitespace,selection,config.files.autoSave,off,config.git.enabled,true,config.notebook.globalToolbar,true,config.terminal.integrated.tabs.enabled,true,config.terminal.integrated.tabs.showActions,singleTerminalOrNarrow,config.terminal.integrated.tabs.showActiveTerminal,singleTerminalOrNarrow,config.workbench.activityBar.visible,true,config.workbench.experimental.settingsProfiles.enabled,true,config.workbench.layoutControl.type,both,config.workbench.sideBar.location,left,config.workbench.statusBar.visible,true' ;
867
+ const array = raw . split ( ',' ) ;
868
+ const tuples : [ string , string ] [ ] = [ ] ;
869
+ for ( let i = 0 ; i < array . length ; i += 2 ) {
870
+ tuples . push ( [ array [ i ] , array [ i + 1 ] ] ) ;
871
+ }
872
+
873
+ const map = TernarySearchTree . forConfigKeys < string > ( ) ;
874
+ map . fill ( tuples ) ;
875
+
876
+ assert . strictEqual ( [ ...map ] . join ( ) , raw ) ;
877
+ assert . ok ( map . has ( 'config.editor.renderWhitespace' ) ) ;
878
+
879
+ const len = [ ...map ] . length ;
880
+ map . delete ( 'config.editor.renderWhitespace' ) ;
881
+ assert . ok ( map . _isBalanced ( ) ) ;
882
+ assert . strictEqual ( [ ...map ] . length , len - 1 ) ;
883
+ } ) ;
884
+
885
+ test ( 'TernarySearchTree: Cannot read properties of undefined (reading \'length\'): #161618 (random)' , function ( ) {
886
+ const raw = 'config.debug.toolBarLocation,floating,config.editor.renderControlCharacters,true,config.editor.renderWhitespace,selection,config.files.autoSave,off,config.git.enabled,true,config.notebook.globalToolbar,true,config.terminal.integrated.tabs.enabled,true,config.terminal.integrated.tabs.showActions,singleTerminalOrNarrow,config.terminal.integrated.tabs.showActiveTerminal,singleTerminalOrNarrow,config.workbench.activityBar.visible,true,config.workbench.experimental.settingsProfiles.enabled,true,config.workbench.layoutControl.type,both,config.workbench.sideBar.location,left,config.workbench.statusBar.visible,true' ;
887
+ const array = raw . split ( ',' ) ;
888
+ const tuples : [ string , string ] [ ] = [ ] ;
889
+ for ( let i = 0 ; i < array . length ; i += 2 ) {
890
+ tuples . push ( [ array [ i ] , array [ i + 1 ] ] ) ;
891
+ }
892
+
893
+ for ( let round = 100 ; round >= 0 ; round -- ) {
894
+ shuffle ( tuples ) ;
895
+ const map = TernarySearchTree . forConfigKeys < string > ( ) ;
896
+ map . fill ( tuples ) ;
897
+
898
+ assert . strictEqual ( [ ...map ] . join ( ) , raw ) ;
899
+ assert . ok ( map . has ( 'config.editor.renderWhitespace' ) ) ;
900
+
901
+ const len = [ ...map ] . length ;
902
+ map . delete ( 'config.editor.renderWhitespace' ) ;
903
+ assert . ok ( map . _isBalanced ( ) ) ;
904
+ assert . strictEqual ( [ ...map ] . length , len - 1 ) ;
905
+ }
906
+ } ) ;
907
+
865
908
test ( 'TernarySearchTree (PathSegments) - lookup' , function ( ) {
866
909
867
910
const map = new TernarySearchTree < string , number > ( new PathIterator ( ) ) ;
0 commit comments