Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Unity
提交
635884b0
T
Third Party Unity
项目概览
OpenHarmony
/
Third Party Unity
1 年多 前同步成功
通知
37
Star
144
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Unity
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
635884b0
编写于
9月 22, 2013
作者:
M
Mark VanderVoord
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
https://github.com/ThrowTheSwitch/Unity
上级
ff1339ca
f5e2ed76
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
13 addition
and
5 deletion
+13
-5
auto/generate_test_runner.rb
auto/generate_test_runner.rb
+13
-5
未找到文件。
auto/generate_test_runner.rb
浏览文件 @
635884b0
...
@@ -45,7 +45,7 @@ class UnityTestRunnerGenerator
...
@@ -45,7 +45,7 @@ class UnityTestRunnerGenerator
end
end
#build runner file
#build runner file
generate
(
input_file
,
output_file
,
tests
,
used_mocks
)
generate
(
input_file
,
output_file
,
tests
,
used_mocks
,
testfile_includes
)
#determine which files were used to return them
#determine which files were used to return them
all_files_used
=
[
input_file
,
output_file
]
all_files_used
=
[
input_file
,
output_file
]
...
@@ -54,9 +54,9 @@ class UnityTestRunnerGenerator
...
@@ -54,9 +54,9 @@ class UnityTestRunnerGenerator
return
all_files_used
.
uniq
return
all_files_used
.
uniq
end
end
def
generate
(
input_file
,
output_file
,
tests
,
used_mocks
)
def
generate
(
input_file
,
output_file
,
tests
,
used_mocks
,
testfile_includes
)
File
.
open
(
output_file
,
'w'
)
do
|
output
|
File
.
open
(
output_file
,
'w'
)
do
|
output
|
create_header
(
output
,
used_mocks
)
create_header
(
output
,
used_mocks
,
testfile_includes
)
create_externs
(
output
,
tests
,
used_mocks
)
create_externs
(
output
,
tests
,
used_mocks
)
create_mock_management
(
output
,
used_mocks
)
create_mock_management
(
output
,
used_mocks
)
create_suite_setup_and_teardown
(
output
)
create_suite_setup_and_teardown
(
output
)
...
@@ -121,7 +121,10 @@ class UnityTestRunnerGenerator
...
@@ -121,7 +121,10 @@ class UnityTestRunnerGenerator
source
.
gsub!
(
/\/\/.*$/
,
''
)
# remove line comments (all that remain)
source
.
gsub!
(
/\/\/.*$/
,
''
)
# remove line comments (all that remain)
#parse out includes
#parse out includes
return
source
.
scan
(
/^\s*#include\s+\"\s*(.+)\.[hH]\s*\"/
).
flatten
includes
=
source
.
scan
(
/^\s*#include\s+\"\s*(.+)\.[hH]\s*\"/
).
flatten
brackets_includes
=
source
.
scan
(
/^\s*#include\s+<\s*(.+)\s*>/
).
flatten
brackets_includes
.
each
{
|
inc
|
includes
<<
'<'
+
inc
+
'>'
}
return
includes
end
end
def
find_mocks
(
includes
)
def
find_mocks
(
includes
)
...
@@ -132,7 +135,7 @@ class UnityTestRunnerGenerator
...
@@ -132,7 +135,7 @@ class UnityTestRunnerGenerator
return
mock_headers
return
mock_headers
end
end
def
create_header
(
output
,
mocks
)
def
create_header
(
output
,
mocks
,
testfile_includes
)
output
.
puts
(
'/* AUTOGENERATED FILE. DO NOT EDIT. */'
)
output
.
puts
(
'/* AUTOGENERATED FILE. DO NOT EDIT. */'
)
create_runtest
(
output
,
mocks
)
create_runtest
(
output
,
mocks
)
output
.
puts
(
"
\n
//=======Automagically Detected Files To Include====="
)
output
.
puts
(
"
\n
//=======Automagically Detected Files To Include====="
)
...
@@ -144,6 +147,11 @@ class UnityTestRunnerGenerator
...
@@ -144,6 +147,11 @@ class UnityTestRunnerGenerator
output
.
puts
(
'#include <setjmp.h>'
)
output
.
puts
(
'#include <setjmp.h>'
)
output
.
puts
(
'#include <stdio.h>'
)
output
.
puts
(
'#include <stdio.h>'
)
output
.
puts
(
'#include "CException.h"'
)
if
@options
[
:plugins
].
include?
(
:cexception
)
output
.
puts
(
'#include "CException.h"'
)
if
@options
[
:plugins
].
include?
(
:cexception
)
testfile_includes
.
delete
(
"unity"
).
delete
(
"cmock"
)
testrunner_includes
=
testfile_includes
-
mocks
testrunner_includes
.
each
do
|
inc
|
output
.
puts
(
"#include
#{
inc
.
include?
(
'<'
)
?
inc
:
"
\"
#{
inc
.
gsub
(
'.h'
,
''
)
}
.h
\"
"
}
"
)
end
mocks
.
each
do
|
mock
|
mocks
.
each
do
|
mock
|
output
.
puts
(
"#include
\"
#{
mock
.
gsub
(
'.h'
,
''
)
}
.h
\"
"
)
output
.
puts
(
"#include
\"
#{
mock
.
gsub
(
'.h'
,
''
)
}
.h
\"
"
)
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录