Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
abb112ac
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
abb112ac
编写于
9月 08, 2017
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Debt: Fix configuration tests
上级
e4e4374e
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
88 addition
and
58 deletion
+88
-58
src/vs/platform/configuration/test/common/configuration.model.test.ts
...orm/configuration/test/common/configuration.model.test.ts
+87
-0
src/vs/platform/configuration/test/common/configuration.test.ts
.../platform/configuration/test/common/configuration.test.ts
+1
-58
未找到文件。
src/vs/platform/configuration/test/common/configuration.model.test.ts
0 → 100644
浏览文件 @
abb112ac
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
*
as
assert
from
'
assert
'
;
import
{
ConfigurationModel
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
Extensions
,
IConfigurationRegistry
}
from
'
vs/platform/configuration/common/configurationRegistry
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
suite
(
'
Configuration
'
,
()
=>
{
suiteSetup
(()
=>
{
Registry
.
as
<
IConfigurationRegistry
>
(
Extensions
.
Configuration
).
registerConfiguration
({
'
id
'
:
'
a
'
,
'
order
'
:
1
,
'
title
'
:
'
a
'
,
'
type
'
:
'
object
'
,
'
properties
'
:
{
'
a
'
:
{
'
description
'
:
'
a
'
,
'
type
'
:
'
boolean
'
,
'
default
'
:
true
,
'
overridable
'
:
true
}
}
});
});
test
(
'
simple merge
'
,
()
=>
{
let
base
=
new
ConfigurationModel
<
any
>
({
'
a
'
:
1
,
'
b
'
:
2
});
let
add
=
new
ConfigurationModel
<
any
>
({
'
a
'
:
3
,
'
c
'
:
4
});
let
result
=
base
.
merge
(
add
);
assert
.
deepEqual
(
result
.
contents
,
{
'
a
'
:
3
,
'
b
'
:
2
,
'
c
'
:
4
});
});
test
(
'
recursive merge
'
,
()
=>
{
let
base
=
new
ConfigurationModel
({
'
a
'
:
{
'
b
'
:
1
}
});
let
add
=
new
ConfigurationModel
({
'
a
'
:
{
'
b
'
:
2
}
});
let
result
=
base
.
merge
(
add
);
assert
.
deepEqual
(
result
.
contents
,
{
'
a
'
:
{
'
b
'
:
2
}
});
});
test
(
'
simple merge overrides
'
,
()
=>
{
let
base
=
new
ConfigurationModel
<
any
>
({
'
a
'
:
{
'
b
'
:
1
}
},
[],
[{
identifiers
:
[
'
c
'
],
contents
:
{
'
a
'
:
2
}
}]);
let
add
=
new
ConfigurationModel
<
any
>
({
'
a
'
:
{
'
b
'
:
2
}
},
[],
[{
identifiers
:
[
'
c
'
],
contents
:
{
'
b
'
:
2
}
}]);
let
result
=
base
.
merge
(
add
);
assert
.
deepEqual
(
result
.
contents
,
{
'
a
'
:
{
'
b
'
:
2
}
});
assert
.
deepEqual
(
result
.
overrides
,
[{
identifiers
:
[
'
c
'
],
contents
:
{
'
a
'
:
2
,
'
b
'
:
2
}
}]);
});
test
(
'
recursive merge overrides
'
,
()
=>
{
let
base
=
new
ConfigurationModel
<
any
>
({
'
a
'
:
{
'
b
'
:
1
}
},
[],
[{
identifiers
:
[
'
c
'
],
contents
:
{
'
a
'
:
{
'
d
'
:
1
}
}
}]);
let
add
=
new
ConfigurationModel
<
any
>
({
'
a
'
:
{
'
b
'
:
2
}
},
[],
[{
identifiers
:
[
'
c
'
],
contents
:
{
'
a
'
:
{
'
e
'
:
2
}
}
}]);
let
result
=
base
.
merge
(
add
);
assert
.
deepEqual
(
result
.
contents
,
{
'
a
'
:
{
'
b
'
:
2
}
});
assert
.
deepEqual
(
result
.
overrides
,
[{
identifiers
:
[
'
c
'
],
contents
:
{
'
a
'
:
{
'
d
'
:
1
,
'
e
'
:
2
}
}
}]);
});
test
(
'
merge ignore keys
'
,
()
=>
{
let
base
=
new
ConfigurationModel
<
any
>
({
'
a
'
:
1
,
'
b
'
:
2
});
let
add
=
new
ConfigurationModel
<
any
>
({
'
a
'
:
3
,
'
c
'
:
4
});
let
result
=
base
.
merge
(
add
);
assert
.
deepEqual
(
result
.
keys
,
[]);
});
test
(
'
Test contents while getting an existing property
'
,
()
=>
{
let
testObject
=
new
ConfigurationModel
({
'
a
'
:
1
});
assert
.
deepEqual
(
testObject
.
getContentsFor
(
'
a
'
),
1
);
testObject
=
new
ConfigurationModel
<
any
>
({
'
a
'
:
{
'
b
'
:
1
}
});
assert
.
deepEqual
(
testObject
.
getContentsFor
(
'
a
'
),
{
'
b
'
:
1
});
});
test
(
'
Test contents are undefined for non existing properties
'
,
()
=>
{
const
testObject
=
new
ConfigurationModel
({
awesome
:
true
});
assert
.
deepEqual
(
testObject
.
getContentsFor
(
'
unknownproperty
'
),
undefined
);
});
test
(
'
Test override gives all content merged with overrides
'
,
()
=>
{
const
testObject
=
new
ConfigurationModel
<
any
>
({
'
a
'
:
1
,
'
c
'
:
1
},
[],
[{
identifiers
:
[
'
b
'
],
contents
:
{
'
a
'
:
2
}
}]);
assert
.
deepEqual
(
testObject
.
override
(
'
b
'
).
contents
,
{
'
a
'
:
2
,
'
c
'
:
1
});
});
});
\ No newline at end of file
src/vs/platform/configuration/test/common/configuration.test.ts
浏览文件 @
abb112ac
...
...
@@ -5,29 +5,10 @@
'
use strict
'
;
import
*
as
assert
from
'
assert
'
;
import
{
ConfigurationModel
,
merge
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
Extensions
,
IConfigurationRegistry
}
from
'
vs/platform/configuration/common/configurationRegistry
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
merge
}
from
'
vs/platform/configuration/common/configuration
'
;
suite
(
'
Configuration
'
,
()
=>
{
suiteSetup
(()
=>
{
Registry
.
as
<
IConfigurationRegistry
>
(
Extensions
.
Configuration
).
registerConfiguration
({
'
id
'
:
'
a
'
,
'
order
'
:
1
,
'
title
'
:
'
a
'
,
'
type
'
:
'
object
'
,
'
properties
'
:
{
'
a
'
:
{
'
description
'
:
'
a
'
,
'
type
'
:
'
boolean
'
,
'
default
'
:
true
,
'
overridable
'
:
true
}
}
});
});
test
(
'
simple merge
'
,
()
=>
{
let
base
=
{
'
a
'
:
1
,
'
b
'
:
2
};
merge
(
base
,
{
'
a
'
:
3
,
'
c
'
:
4
},
true
);
...
...
@@ -37,43 +18,5 @@ suite('Configuration', () => {
assert
.
deepEqual
(
base
,
{
'
a
'
:
1
,
'
b
'
:
2
,
'
c
'
:
4
});
});
test
(
'
Recursive merge
'
,
()
=>
{
const
base
=
{
'
a
'
:
{
'
b
'
:
1
}
};
merge
(
base
,
{
'
a
'
:
{
'
b
'
:
2
}
},
true
);
assert
.
deepEqual
(
base
,
{
'
a
'
:
{
'
b
'
:
2
}
});
});
test
(
'
simple merge using configuration
'
,
()
=>
{
let
base
=
new
ConfigurationModel
<
any
>
({
'
a
'
:
1
,
'
b
'
:
2
});
let
add
=
new
ConfigurationModel
<
any
>
({
'
a
'
:
3
,
'
c
'
:
4
});
let
result
=
base
.
merge
(
add
);
assert
.
deepEqual
(
result
.
contents
,
{
'
a
'
:
3
,
'
b
'
:
2
,
'
c
'
:
4
});
});
test
(
'
Recursive merge using config models
'
,
()
=>
{
let
base
=
new
ConfigurationModel
({
'
a
'
:
{
'
b
'
:
1
}
});
let
add
=
new
ConfigurationModel
({
'
a
'
:
{
'
b
'
:
2
}
});
let
result
=
base
.
merge
(
add
);
assert
.
deepEqual
(
result
.
contents
,
{
'
a
'
:
{
'
b
'
:
2
}
});
});
test
(
'
Test contents while getting an existing property
'
,
()
=>
{
let
testObject
=
new
ConfigurationModel
({
'
a
'
:
1
});
assert
.
deepEqual
(
testObject
.
getContentsFor
(
'
a
'
),
1
);
testObject
=
new
ConfigurationModel
<
any
>
({
'
a
'
:
{
'
b
'
:
1
}
});
assert
.
deepEqual
(
testObject
.
getContentsFor
(
'
a
'
),
{
'
b
'
:
1
});
});
test
(
'
Test contents are undefined for non existing properties
'
,
()
=>
{
const
testObject
=
new
ConfigurationModel
({
awesome
:
true
});
assert
.
deepEqual
(
testObject
.
getContentsFor
(
'
unknownproperty
'
),
undefined
);
});
test
(
'
Test override gives all content merged with overrides
'
,
()
=>
{
const
testObject
=
new
ConfigurationModel
<
any
>
({
'
a
'
:
1
,
'
c
'
:
1
},
[],
[{
identifiers
:
[
'
b
'
],
contents
:
{
'
a
'
:
2
}
}]);
assert
.
deepEqual
(
testObject
.
override
(
'
b
'
).
contents
,
{
'
a
'
:
2
,
'
c
'
:
1
});
});
});
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录