@@ -28,7 +28,48 @@ suite('ExtHostConfiguration', function () {
2828 return new ExtHostConfiguration ( shape , data ) ;
2929 }
3030
31- test ( 'udate / section to key' , function ( ) {
31+ test ( 'has/get' , function ( ) {
32+
33+ const all = createExtHostConfiguration ( {
34+ farboo : {
35+ config0 : true ,
36+ nested : {
37+ config1 : 42 ,
38+ config2 : 'Das Pferd frisst kein Reis.'
39+ } ,
40+ config4 : ''
41+ }
42+ } ) ;
43+
44+ const config = all . getConfiguration ( 'farboo' ) ;
45+
46+ assert . ok ( config . has ( 'config0' ) ) ;
47+ assert . equal ( config . get ( 'config0' ) , true ) ;
48+ assert . equal ( config . get ( 'config4' ) , '' ) ;
49+ assert . equal ( config [ 'config0' ] , true ) ;
50+ assert . equal ( config [ 'config4' ] , '' ) ;
51+ assert . throws ( ( ) => config [ 'config4' ] = 'valuevalue' ) ;
52+ assert . ok ( config . has ( 'nested.config1' ) ) ;
53+ assert . equal ( config . get ( 'nested.config1' ) , 42 ) ;
54+ assert . ok ( config . has ( 'nested.config2' ) ) ;
55+ assert . equal ( config . get ( 'nested.config2' ) , 'Das Pferd frisst kein Reis.' ) ;
56+ } ) ;
57+
58+ test ( 'name vs property' , function ( ) {
59+ const all = createExtHostConfiguration ( {
60+ farboo : {
61+ get : 'get-prop'
62+ }
63+ } ) ;
64+ const config = all . getConfiguration ( 'farboo' ) ;
65+
66+ assert . ok ( config . has ( 'get' ) ) ;
67+ assert . equal ( config . get ( 'get' ) , 'get-prop' ) ;
68+ assert . deepEqual ( config [ 'get' ] , config . get ) ;
69+ assert . throws ( ( ) => config [ 'get' ] = < any > 'get-prop' ) ;
70+ } ) ;
71+
72+ test ( 'udate/section to key' , function ( ) {
3273
3374 const shape = new RecordingShape ( ) ;
3475 const allConfig = createExtHostConfiguration ( { foo : { bar : 1 , far : 2 } } , shape ) ;
@@ -47,7 +88,7 @@ suite('ExtHostConfiguration', function () {
4788 assert . equal ( shape . lastArgs [ 1 ] , 'foo.bar' ) ;
4889 } ) ;
4990
50- test ( 'update / error-state not OK' , function ( ) {
91+ test ( 'update/ error-state not OK' , function ( ) {
5192
5293 const shape = new class extends MainThreadConfigurationShape {
5394 $updateConfigurationOption ( target : ConfigurationTarget , key : string , value : any ) : TPromise < any > {
0 commit comments