@@ -209,71 +209,57 @@ suite('Configuration Resolver Service', () => {
209209 } ) ;
210210
211211 let service = new ConfigurationResolverService ( uri . parse ( 'file:///VSCode/workspaceLocation' ) , envVariables , new TestEditorService ( ) , TestEnvironmentService , configurationService , mockCommandService ) ;
212- assert . strictEqual ( service . resolve ( 'abc ${config.editor.fontFamily} ${config.editor.lineNumbers} ${config.editor.insertSpaces} ${config.json.schemas[0].fileMatch[1]} xyz' ) , 'abc foo 123 false {{/myOtherfile}} xyz' ) ;
212+ assert . strictEqual ( service . resolve ( 'abc ${config.editor.fontFamily} ${config.editor.lineNumbers} ${config.editor.insertSpaces} xyz' ) , 'abc foo 123 false xyz' ) ;
213213 } ) ;
214214
215- test ( 'configuration variables using bracket accessor' , ( ) => {
216- let configurationService : IConfigurationService ;
217- configurationService = new MockConfigurationService ( {
218- editor : {
219- fontFamily : 'foo'
220- }
221- } ) ;
222-
223- let service = new ConfigurationResolverService ( uri . parse ( 'file:///VSCode/workspaceLocation' ) , envVariables , new TestEditorService ( ) , TestEnvironmentService , configurationService , mockCommandService ) ;
224- assert . strictEqual ( service . resolve ( "abc ${config.editor['fontFamily']} xyz" ) , 'abc foo xyz' ) ;
225- assert . strictEqual ( service . resolve ( 'abc ${config["editor"].fontFamily} xyz' ) , 'abc foo xyz' ) ;
226- assert . strictEqual ( service . resolve ( 'abc ${config["editor"]["fontFamily"]} xyz' ) , 'abc foo xyz' ) ;
227- } ) ;
228-
229- test ( 'configuration variables with invalid accessor' , ( ) => {
215+ test ( 'configuration should not evaluate Javascript' , ( ) => {
230216 let configurationService : IConfigurationService ;
231217 configurationService = new MockConfigurationService ( {
232218 editor : {
233- fontFamily : 'foo'
219+ abc : 'foo'
234220 }
235221 } ) ;
236222
237223 let service = new ConfigurationResolverService ( uri . parse ( 'file:///VSCode/workspaceLocation' ) , envVariables , new TestEditorService ( ) , TestEnvironmentService , configurationService , mockCommandService ) ;
238- assert . strictEqual ( service . resolve ( "abc ${config.} xyz" ) , 'abc ${config.} xyz' ) ;
239- assert . strictEqual ( service . resolve ( "abc ${config.editor..fontFamily} xyz" ) , 'abc xyz' ) ;
240- assert . strictEqual ( service . resolve ( "abc ${config.editor.none.none2} xyz" ) , 'abc xyz' ) ;
224+ assert . strictEqual ( service . resolve ( 'abc ${config.editor[\'abc\'.substr(0)]} xyz' ) , 'abc xyz' ) ;
241225 } ) ;
242226
243- test ( 'configuration should not evaluate Javascript ' , ( ) => {
227+ test ( 'uses empty string as fallback ' , ( ) => {
244228 let configurationService : IConfigurationService ;
245229 configurationService = new MockConfigurationService ( {
246- editor : {
247- abc : 'foo'
248- }
230+ editor : { }
249231 } ) ;
250232
251233 let service = new ConfigurationResolverService ( uri . parse ( 'file:///VSCode/workspaceLocation' ) , envVariables , new TestEditorService ( ) , TestEnvironmentService , configurationService , mockCommandService ) ;
252- assert . strictEqual ( service . resolve ( "abc ${config.editor['abc'.substr(0)]} xyz" ) , 'abc xyz' ) ;
234+ assert . strictEqual ( service . resolve ( 'abc ${config.editor.abc} xyz' ) , 'abc xyz' ) ;
235+ assert . strictEqual ( service . resolve ( 'abc ${config.editor.abc.def} xyz' ) , 'abc xyz' ) ;
236+ assert . strictEqual ( service . resolve ( 'abc ${config.panel} xyz' ) , 'abc xyz' ) ;
237+ assert . strictEqual ( service . resolve ( 'abc ${config.panel.abc} xyz' ) , 'abc xyz' ) ;
253238 } ) ;
254239
255- test ( 'uses empty string as fallback ' , ( ) => {
240+ test ( 'is restricted to own properties ' , ( ) => {
256241 let configurationService : IConfigurationService ;
257242 configurationService = new MockConfigurationService ( {
258243 editor : { }
259244 } ) ;
260245
261246 let service = new ConfigurationResolverService ( uri . parse ( 'file:///VSCode/workspaceLocation' ) , envVariables , new TestEditorService ( ) , TestEnvironmentService , configurationService , mockCommandService ) ;
262- assert . strictEqual ( service . resolve ( "abc ${config.editor.abc} xyz" ) , 'abc xyz' ) ;
263- assert . strictEqual ( service . resolve ( "abc ${config.editor.abc.def} xyz" ) , 'abc xyz' ) ;
264- assert . strictEqual ( service . resolve ( "abc ${config.panel} xyz" ) , 'abc xyz' ) ;
265- assert . strictEqual ( service . resolve ( "abc ${config.panel.abc} xyz" ) , 'abc xyz' ) ;
247+ assert . strictEqual ( service . resolve ( 'abc ${config.editor.__proto__} xyz' ) , 'abc xyz' ) ;
248+ assert . strictEqual ( service . resolve ( 'abc ${config.editor.toString} xyz' ) , 'abc xyz' ) ;
266249 } ) ;
267250
268- test ( 'is restricted to own properties ' , ( ) => {
251+ test ( 'configuration variables with invalid accessor ' , ( ) => {
269252 let configurationService : IConfigurationService ;
270253 configurationService = new MockConfigurationService ( {
271- editor : { }
254+ editor : {
255+ fontFamily : 'foo'
256+ }
272257 } ) ;
273258
274259 let service = new ConfigurationResolverService ( uri . parse ( 'file:///VSCode/workspaceLocation' ) , envVariables , new TestEditorService ( ) , TestEnvironmentService , configurationService , mockCommandService ) ;
275- assert . strictEqual ( service . resolve ( "abc ${config.editor.__proto__} xyz" ) , 'abc xyz' ) ;
276- assert . strictEqual ( service . resolve ( "abc ${config.editor.toString} xyz" ) , 'abc xyz' ) ;
260+ assert . strictEqual ( service . resolve ( 'abc ${config.} xyz' ) , 'abc ${config.} xyz' ) ;
261+ assert . strictEqual ( service . resolve ( 'abc ${config.editor..fontFamily} xyz' ) , 'abc xyz' ) ;
262+ assert . strictEqual ( service . resolve ( 'abc ${config.editor.none.none2} xyz' ) , 'abc xyz' ) ;
277263 } ) ;
278264
279265 test ( 'interactive variable simple' , ( ) => {
0 commit comments