mirror of
https://github.com/atom/atom.git
synced 2026-02-18 18:34:21 -05:00
String type must be strict.
It makes sense to coerce from more general -> more specific data types. eg. string -> int, etc. But coercing the other way is problematic in the case of chaining because the more general type will swallow the specific type. eg. Setting `false` on type: [‘string’, ‘boolean’] will coerce the boolean to a string, and will never allow the value to be a boolean.
This commit is contained in:
@@ -701,21 +701,21 @@ describe "Config", ->
|
||||
atom.config.set('foo.bar.aString', 'yep')
|
||||
expect(atom.config.get('foo.bar.aString')).toBe 'yep'
|
||||
|
||||
it 'will only set strings, numbers and booleans', ->
|
||||
expect(atom.config.set('foo.bar.aString', 123)).toBe true
|
||||
expect(atom.config.get('foo.bar.aString')).toBe '123'
|
||||
it 'will only set strings', ->
|
||||
expect(atom.config.set('foo.bar.aString', 123)).toBe false
|
||||
expect(atom.config.get('foo.bar.aString')).toBe 'ok'
|
||||
|
||||
expect(atom.config.set('foo.bar.aString', true)).toBe false
|
||||
expect(atom.config.get('foo.bar.aString')).toBe '123'
|
||||
expect(atom.config.get('foo.bar.aString')).toBe 'ok'
|
||||
|
||||
expect(atom.config.set('foo.bar.aString', null)).toBe false
|
||||
expect(atom.config.get('foo.bar.aString')).toBe '123'
|
||||
expect(atom.config.get('foo.bar.aString')).toBe 'ok'
|
||||
|
||||
expect(atom.config.set('foo.bar.aString', [])).toBe false
|
||||
expect(atom.config.get('foo.bar.aString')).toBe '123'
|
||||
expect(atom.config.get('foo.bar.aString')).toBe 'ok'
|
||||
|
||||
expect(atom.config.set('foo.bar.aString', nope: 'nope')).toBe false
|
||||
expect(atom.config.get('foo.bar.aString')).toBe '123'
|
||||
expect(atom.config.get('foo.bar.aString')).toBe 'ok'
|
||||
|
||||
describe 'when the value has an "object" type', ->
|
||||
beforeEach ->
|
||||
|
||||
Reference in New Issue
Block a user