Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
a5ae040d
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a5ae040d
编写于
4月 11, 2016
作者:
M
Martin Aeschlimann
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[js/ts] colorizer tests
上级
e475fdeb
变更
6
展开全部
显示空白变更内容
内联
并排
Showing
6 changed file
with
12619 addition
and
0 deletion
+12619
-0
extensions/javascript/test/colorize-fixtures/test.js
extensions/javascript/test/colorize-fixtures/test.js
+37
-0
extensions/javascript/test/colorize-fixtures/test.jsx
extensions/javascript/test/colorize-fixtures/test.jsx
+35
-0
extensions/javascript/test/colorize-results/test_js.json
extensions/javascript/test/colorize-results/test_js.json
+2389
-0
extensions/javascript/test/colorize-results/test_jsx.json
extensions/javascript/test/colorize-results/test_jsx.json
+1806
-0
extensions/typescript/test/colorize-fixtures/test.ts
extensions/typescript/test/colorize-fixtures/test.ts
+111
-0
extensions/typescript/test/colorize-results/test_ts.json
extensions/typescript/test/colorize-results/test_ts.json
+8241
-0
未找到文件。
extensions/javascript/test/colorize-fixtures/test.js
0 → 100644
浏览文件 @
a5ae040d
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var
gulp
=
require
(
'
gulp
'
);
var
tsb
=
require
(
'
gulp-tsb
'
);
var
util
=
require
(
'
./lib/util
'
);
var
watcher
=
require
(
'
./lib/watch
'
);
var
assign
=
require
(
'
object-assign
'
);
var
compilation
=
tsb
.
create
(
assign
({
verbose
:
true
},
require
(
'
./tsconfig.json
'
).
compilerOptions
));
gulp
.
task
(
'
compile
'
,
function
()
{
return
gulp
.
src
(
'
**/*.ts
'
,
{
base
:
'
.
'
})
.
pipe
(
compilation
())
.
pipe
(
gulp
.
dest
(
''
));
});
gulp
.
task
(
'
watch
'
,
function
()
{
var
src
=
gulp
.
src
(
'
**/*.ts
'
,
{
base
:
'
.
'
});
return
watcher
(
'
**/*.ts
'
,
{
base
:
'
.
'
})
.
pipe
(
util
.
incremental
(
compilation
,
src
))
.
pipe
(
gulp
.
dest
(
''
));
});
gulp
.
task
(
'
default
'
,
[
'
compile
'
]);
function
cloneArray
(
arr
)
{
_
.
foo
();
var
r
=
[];
for
(
var
i
=
0
,
len
=
arr
.
length
;
i
<
len
;
i
++
)
{
r
[
i
]
=
doClone
(
arr
[
i
]);
}
return
r
;
}
\ No newline at end of file
extensions/javascript/test/colorize-fixtures/test.jsx
0 → 100644
浏览文件 @
a5ae040d
var
ToggleText
=
React
.
createClass
({
getInitialState
:
function
()
{
return
{
showDefault
:
true
}
},
toggle
:
function
(
e
)
{
// Prevent following the link.
e
.
preventDefault
();
// Invert the chosen default.
// This will trigger an intelligent re-render of the component.
this
.
setState
({
showDefault
:
!
this
.
state
.
showDefault
})
},
render
:
function
()
{
// Default to the default message.
var
message
=
this
.
props
.
default
;
// If toggled, show the alternate message.
if
(
!
this
.
state
.
showDefault
)
{
message
=
this
.
props
.
alt
;
}
return
(
<
div
>
<
h1
>
Hello
{
message
}
!
</
h1
>
<
a
href
=
""
onClick
=
{
this
.
toggle
}
>
Toggle
</
a
>
</
div
>
);
}
});
React
.
render
(<
ToggleText
default
=
"World"
alt
=
"Mars"
/>,
document
.
body
);
\ No newline at end of file
extensions/javascript/test/colorize-results/test_js.json
0 → 100644
浏览文件 @
a5ae040d
此差异已折叠。
点击以展开。
extensions/javascript/test/colorize-results/test_jsx.json
0 → 100644
浏览文件 @
a5ae040d
此差异已折叠。
点击以展开。
extensions/typescript/test/colorize-fixtures/test.ts
0 → 100644
浏览文件 @
a5ae040d
/* Game of Life
* Implemented in TypeScript
* To learn more about TypeScript, please visit http://www.typescriptlang.org/
*/
module
Conway
{
export
class
Cell
{
public
row
:
number
;
public
col
:
number
;
public
live
:
boolean
;
constructor
(
row
:
number
,
col
:
number
,
live
:
boolean
)
{
this
.
row
=
row
;
this
.
col
=
col
;
this
.
live
=
live
}
}
export
class
GameOfLife
{
private
gridSize
:
number
;
private
canvasSize
:
number
;
private
lineColor
:
string
;
private
liveColor
:
string
;
private
deadColor
:
string
;
private
initialLifeProbability
:
number
;
private
animationRate
:
number
;
private
cellSize
:
number
;
private
world
;
constructor
()
{
this
.
gridSize
=
50
;
this
.
canvasSize
=
600
;
this
.
lineColor
=
'
#cdcdcd
'
;
this
.
liveColor
=
'
#666
'
;
this
.
deadColor
=
'
#eee
'
;
this
.
initialLifeProbability
=
0.5
;
this
.
animationRate
=
60
;
this
.
cellSize
=
0
;
this
.
world
=
this
.
createWorld
();
this
.
circleOfLife
();
}
public
createWorld
()
{
return
this
.
travelWorld
(
(
cell
:
Cell
)
=>
{
cell
.
live
=
Math
.
random
()
<
this
.
initialLifeProbability
;
return
cell
;
});
}
public
circleOfLife
()
:
void
{
this
.
world
=
this
.
travelWorld
(
(
cell
:
Cell
)
=>
{
cell
=
this
.
world
[
cell
.
row
][
cell
.
col
];
this
.
draw
(
cell
);
return
this
.
resolveNextGeneration
(
cell
);
});
setTimeout
(
()
=>
{
this
.
circleOfLife
()},
this
.
animationRate
);
}
public
resolveNextGeneration
(
cell
:
Cell
)
{
var
count
=
this
.
countNeighbors
(
cell
);
var
newCell
=
new
Cell
(
cell
.
row
,
cell
.
col
,
cell
.
live
);
if
(
count
<
2
||
count
>
3
)
newCell
.
live
=
false
;
else
if
(
count
==
3
)
newCell
.
live
=
true
;
return
newCell
;
}
public
countNeighbors
(
cell
:
Cell
)
{
var
neighbors
=
0
;
for
(
var
row
=
-
1
;
row
<=
1
;
row
++
)
{
for
(
var
col
=
-
1
;
col
<=
1
;
col
++
)
{
if
(
row
==
0
&&
col
==
0
)
continue
;
if
(
this
.
isAlive
(
cell
.
row
+
row
,
cell
.
col
+
col
))
{
neighbors
++
;
}
}
}
return
neighbors
;
}
public
isAlive
(
row
:
number
,
col
:
number
)
{
if
(
row
<
0
||
col
<
0
||
row
>=
this
.
gridSize
||
col
>=
this
.
gridSize
)
return
false
;
return
this
.
world
[
row
][
col
].
live
;
}
public
travelWorld
(
callback
)
{
var
result
=
[];
for
(
var
row
=
0
;
row
<
this
.
gridSize
;
row
++
)
{
var
rowData
=
[];
for
(
var
col
=
0
;
col
<
this
.
gridSize
;
col
++
)
{
rowData
.
push
(
callback
(
new
Cell
(
row
,
col
,
false
)));
}
result
.
push
(
rowData
);
}
return
result
;
}
public
draw
(
cell
:
Cell
)
{
if
(
this
.
cellSize
==
0
)
this
.
cellSize
=
this
.
canvasSize
/
this
.
gridSize
;
this
.
context
.
strokeStyle
=
this
.
lineColor
;
this
.
context
.
strokeRect
(
cell
.
row
*
this
.
cellSize
,
cell
.
col
*
this
.
cellSize
,
this
.
cellSize
,
this
.
cellSize
);
this
.
context
.
fillStyle
=
cell
.
live
?
this
.
liveColor
:
this
.
deadColor
;
this
.
context
.
fillRect
(
cell
.
row
*
this
.
cellSize
,
cell
.
col
*
this
.
cellSize
,
this
.
cellSize
,
this
.
cellSize
);
}
}
}
var
game
=
new
Conway
.
GameOfLife
();
extensions/typescript/test/colorize-results/test_ts.json
0 → 100644
浏览文件 @
a5ae040d
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录