Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Unity
提交
37a0f718
T
Third Party Unity
项目概览
OpenHarmony
/
Third Party Unity
1 年多 前同步成功
通知
36
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看板
未验证
提交
37a0f718
编写于
10月 30, 2019
作者:
M
Mark VanderVoord
提交者:
GitHub
10月 30, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #459 from elliot-gawthrop/combined_suite
Option to omit UnityBegin/UnityEnd calls in generate_test_runner
上级
2aaf3c45
a303e088
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
23 addition
and
5 deletion
+23
-5
auto/generate_test_runner.rb
auto/generate_test_runner.rb
+16
-5
src/unity.c
src/unity.c
+6
-0
src/unity_internals.h
src/unity_internals.h
+1
-0
未找到文件。
auto/generate_test_runner.rb
浏览文件 @
37a0f718
...
@@ -41,6 +41,7 @@ class UnityTestRunnerGenerator
...
@@ -41,6 +41,7 @@ class UnityTestRunnerGenerator
main_name:
'main'
,
# set to :auto to automatically generate each time
main_name:
'main'
,
# set to :auto to automatically generate each time
main_export_decl:
''
,
main_export_decl:
''
,
cmdline_args:
false
,
cmdline_args:
false
,
omit_begin_end:
false
,
use_param_tests:
false
use_param_tests:
false
}
}
end
end
...
@@ -376,14 +377,19 @@ class UnityTestRunnerGenerator
...
@@ -376,14 +377,19 @@ class UnityTestRunnerGenerator
output
.
puts
(
' return parse_status;'
)
output
.
puts
(
' return parse_status;'
)
output
.
puts
(
' }'
)
output
.
puts
(
' }'
)
else
else
main_return
=
@options
[
:omit_begin_end
]
?
'void'
:
'int'
if
main_name
!=
'main'
if
main_name
!=
'main'
output
.
puts
(
"
#{
@options
[
:main_export_decl
]
}
int
#{
main_name
}
(void);"
)
output
.
puts
(
"
#{
@options
[
:main_export_decl
]
}
#{
main_return
}
#{
main_name
}
(void);"
)
end
end
output
.
puts
(
"
int
#{
main_name
}
(void)"
)
output
.
puts
(
"
#{
main_return
}
#{
main_name
}
(void)"
)
output
.
puts
(
'{'
)
output
.
puts
(
'{'
)
end
end
output
.
puts
(
' suiteSetUp();'
)
if
@options
[
:has_suite_setup
]
output
.
puts
(
' suiteSetUp();'
)
if
@options
[
:has_suite_setup
]
output
.
puts
(
" UnityBegin(
\"
#{
filename
.
gsub
(
/\\/
,
'\\\\\\'
)
}
\"
);"
)
if
@options
[
:omit_begin_end
]
output
.
puts
(
" UnitySetTestFile(
\"
#{
filename
.
gsub
(
/\\/
,
'\\\\\\'
)
}
\"
);"
)
else
output
.
puts
(
" UnityBegin(
\"
#{
filename
.
gsub
(
/\\/
,
'\\\\\\'
)
}
\"
);"
)
end
tests
.
each
do
|
test
|
tests
.
each
do
|
test
|
if
(
!
@options
[
:use_param_tests
])
||
test
[
:args
].
nil?
||
test
[
:args
].
empty?
if
(
!
@options
[
:use_param_tests
])
||
test
[
:args
].
nil?
||
test
[
:args
].
empty?
output
.
puts
(
" run_test(
#{
test
[
:test
]
}
,
\"
#{
test
[
:test
]
}
\"
,
#{
test
[
:line_number
]
}
);"
)
output
.
puts
(
" run_test(
#{
test
[
:test
]
}
,
\"
#{
test
[
:test
]
}
\"
,
#{
test
[
:line_number
]
}
);"
)
...
@@ -398,9 +404,13 @@ class UnityTestRunnerGenerator
...
@@ -398,9 +404,13 @@ class UnityTestRunnerGenerator
output
.
puts
output
.
puts
output
.
puts
(
' CMock_Guts_MemFreeFinal();'
)
unless
used_mocks
.
empty?
output
.
puts
(
' CMock_Guts_MemFreeFinal();'
)
unless
used_mocks
.
empty?
if
@options
[
:has_suite_teardown
]
if
@options
[
:has_suite_teardown
]
output
.
puts
(
' return suiteTearDown(UnityEnd());'
)
if
@options
[
:omit_begin_end
]
output
.
puts
(
' (void) suite_teardown(0);'
)
else
output
.
puts
(
' return suiteTearDown(UnityEnd());'
)
end
else
else
output
.
puts
(
' return UnityEnd();'
)
output
.
puts
(
' return UnityEnd();'
)
if
not
@options
[
:omit_begin_end
]
end
end
output
.
puts
(
'}'
)
output
.
puts
(
'}'
)
end
end
...
@@ -473,6 +483,7 @@ if $0 == __FILE__
...
@@ -473,6 +483,7 @@ if $0 == __FILE__
' --suite_setup="" - code to execute for setup of entire suite'
,
' --suite_setup="" - code to execute for setup of entire suite'
,
' --suite_teardown="" - code to execute for teardown of entire suite'
,
' --suite_teardown="" - code to execute for teardown of entire suite'
,
' --use_param_tests=1 - enable parameterized tests (disabled by default)'
,
' --use_param_tests=1 - enable parameterized tests (disabled by default)'
,
' --omit_begin_end=1 - omit calls to UnityBegin and UnityEnd (disabled by default)'
,
' --header_file="" - path/name of test header file to generate too'
].
join
(
"
\n
"
)
' --header_file="" - path/name of test header file to generate too'
].
join
(
"
\n
"
)
exit
1
exit
1
end
end
...
...
src/unity.c
浏览文件 @
37a0f718
...
@@ -1820,6 +1820,12 @@ void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int
...
@@ -1820,6 +1820,12 @@ void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int
UnityConcludeTest
();
UnityConcludeTest
();
}
}
/*-----------------------------------------------*/
void
UnitySetTestFile
(
const
char
*
filename
)
{
Unity
.
TestFile
=
filename
;
}
/*-----------------------------------------------*/
/*-----------------------------------------------*/
void
UnityBegin
(
const
char
*
filename
)
void
UnityBegin
(
const
char
*
filename
)
{
{
...
...
src/unity_internals.h
浏览文件 @
37a0f718
...
@@ -477,6 +477,7 @@ extern struct UNITY_STORAGE_T Unity;
...
@@ -477,6 +477,7 @@ extern struct UNITY_STORAGE_T Unity;
void
UnityBegin
(
const
char
*
filename
);
void
UnityBegin
(
const
char
*
filename
);
int
UnityEnd
(
void
);
int
UnityEnd
(
void
);
void
UnitySetTestFile
(
const
char
*
filename
);
void
UnityConcludeTest
(
void
);
void
UnityConcludeTest
(
void
);
void
UnityDefaultTestRun
(
UnityTestFunction
Func
,
const
char
*
FuncName
,
const
int
FuncLineNum
);
void
UnityDefaultTestRun
(
UnityTestFunction
Func
,
const
char
*
FuncName
,
const
int
FuncLineNum
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录