@@ -7,7 +7,7 @@ import { Terminal } from 'xterm';
7
7
import { strictEqual , deepStrictEqual } from 'assert' ;
8
8
import { timeout } from 'vs/base/common/async' ;
9
9
import * as sinon from 'sinon' ;
10
- import { ShellIntegrationAddon } from 'vs/platform/terminal/common/xterm/shellIntegrationAddon' ;
10
+ import { parseKeyValueAssignment , ShellIntegrationAddon } from 'vs/platform/terminal/common/xterm/shellIntegrationAddon' ;
11
11
import { ITerminalCapabilityStore , TerminalCapability } from 'vs/platform/terminal/common/capabilities/capabilities' ;
12
12
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock' ;
13
13
import { ILogService , NullLogService } from 'vs/platform/log/common/log' ;
@@ -197,3 +197,23 @@ suite('ShellIntegrationAddon', () => {
197
197
} ) ;
198
198
} ) ;
199
199
} ) ;
200
+
201
+ test ( 'parseKeyValueAssignment' , ( ) => {
202
+ type TestCase = [ title : string , input : string , expected : [ key : string , value : string | undefined ] ] ;
203
+ const cases : TestCase [ ] = [
204
+ [ 'empty' , '' , [ '' , undefined ] ] ,
205
+ [ 'no "=" sign' , 'some-text' , [ 'some-text' , undefined ] ] ,
206
+ [ 'empty value' , 'key=' , [ 'key' , '' ] ] ,
207
+ [ 'empty key' , '=value' , [ '' , 'value' ] ] ,
208
+ [ 'normal' , 'key=value' , [ 'key' , 'value' ] ] ,
209
+ [ 'multiple "=" signs (1)' , 'key==value' , [ 'key' , '=value' ] ] ,
210
+ [ 'multiple "=" signs (2)' , 'key=value===true' , [ 'key' , 'value===true' ] ] ,
211
+ [ 'just a "="' , '=' , [ '' , '' ] ] ,
212
+ [ 'just a "=="' , '==' , [ '' , '=' ] ] ,
213
+ ] ;
214
+
215
+ cases . forEach ( x => {
216
+ const [ title , input , [ key , value ] ] = x ;
217
+ deepStrictEqual ( parseKeyValueAssignment ( input ) , { key, value } , title ) ;
218
+ } ) ;
219
+ } ) ;
0 commit comments