Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Unity
提交
57676b5e
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看板
提交
57676b5e
编写于
7月 17, 2016
作者:
M
Mark VanderVoord
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
- Fixed cases with wildcards in file handling.
上级
1cecab30
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
152 addition
and
4 deletion
+152
-4
src/unity.c
src/unity.c
+11
-4
test/testdata/testRunnerGeneratorSmall.c
test/testdata/testRunnerGeneratorSmall.c
+65
-0
test/tests/test_generate_test_runner.rb
test/tests/test_generate_test_runner.rb
+76
-0
未找到文件。
src/unity.c
浏览文件 @
57676b5e
...
...
@@ -1371,6 +1371,9 @@ int IsStringInBiggerString(const char* longstring, const char* shortstring)
char
*
sptr
=
(
char
*
)
shortstring
;
char
*
lnext
=
lptr
;
if
(
*
sptr
==
'*'
)
return
1
;
while
(
*
lptr
)
{
lnext
=
lptr
+
1
;
...
...
@@ -1408,6 +1411,7 @@ int UnityStringArgumentMatches(const char* str)
int
retval
;
const
char
*
ptr1
;
const
char
*
ptr2
;
const
char
*
ptrf
;
//Go through the options and get the substrings for matching one at a time
ptr1
=
str
;
...
...
@@ -1418,10 +1422,13 @@ int UnityStringArgumentMatches(const char* str)
//look for the start of the next partial
ptr2
=
ptr1
;
ptrf
=
0
;
do
{
ptr2
++
;
}
while
((
ptr2
[
0
]
!=
0
)
&&
(
ptr2
[
0
]
!=
':'
)
&&
(
ptr2
[
0
]
!=
'\''
)
&&
(
ptr2
[
0
]
!=
'"'
)
&&
(
ptr2
[
0
]
!=
','
));
while
((
ptr2
[
0
]
==
':'
)
||
(
ptr2
[
0
]
==
'\''
)
||
(
ptr2
[
0
]
==
'"'
)
||
(
ptr2
[
0
]
==
','
))
if
((
ptr2
[
0
]
==
':'
)
&&
(
ptr2
[
1
]
!=
0
)
&&
(
ptr2
[
0
]
!=
'\''
)
&&
(
ptr2
[
0
]
!=
'"'
)
&&
(
ptr2
[
0
]
!=
','
))
ptrf
=
&
ptr2
[
1
];
}
while
((
ptr2
[
0
]
!=
0
)
&&
(
ptr2
[
0
]
!=
'\''
)
&&
(
ptr2
[
0
]
!=
'"'
)
&&
(
ptr2
[
0
]
!=
','
));
while
((
ptr2
[
0
]
!=
0
)
&&
((
ptr2
[
0
]
==
':'
)
||
(
ptr2
[
0
]
==
'\''
)
||
(
ptr2
[
0
]
==
'"'
)
||
(
ptr2
[
0
]
==
','
)))
ptr2
++
;
//done if complete filename match
...
...
@@ -1430,9 +1437,9 @@ int UnityStringArgumentMatches(const char* str)
return
retval
;
//done if testname match after filename partial match
if
(
retval
==
2
)
if
(
(
retval
==
2
)
&&
(
ptrf
!=
0
)
)
{
if
(
IsStringInBiggerString
(
Unity
.
CurrentTestName
,
ptr
2
))
if
(
IsStringInBiggerString
(
Unity
.
CurrentTestName
,
ptr
f
))
return
1
;
}
...
...
test/testdata/testRunnerGeneratorSmall.c
0 → 100644
浏览文件 @
57676b5e
/* This Test File Is Used To Verify Many Combinations Of Using the Generate Test Runner Script */
#include <stdio.h>
#include "unity.h"
#include "Defs.h"
/* Notes about prefixes:
test - normal default prefix. these are "always run" tests for this procedure
spec - normal default prefix. required to run default setup/teardown calls.
*/
/* Support for Meta Test Rig */
#define TEST_CASE(a)
void
putcharSpy
(
int
c
)
{
(
void
)
putchar
(
c
);}
// include passthrough for linking tests
/* Global Variables Used During These Tests */
int
CounterSetup
=
0
;
int
CounterTeardown
=
0
;
int
CounterSuiteSetup
=
0
;
void
setUp
(
void
)
{
CounterSetup
=
1
;
}
void
tearDown
(
void
)
{
CounterTeardown
=
1
;
}
void
custom_setup
(
void
)
{
CounterSetup
=
2
;
}
void
custom_teardown
(
void
)
{
CounterTeardown
=
2
;
}
void
test_ThisTestAlwaysPasses
(
void
)
{
TEST_PASS
();
}
void
test_ThisTestAlwaysFails
(
void
)
{
TEST_FAIL_MESSAGE
(
"This Test Should Fail"
);
}
void
test_ThisTestAlwaysIgnored
(
void
)
{
TEST_IGNORE_MESSAGE
(
"This Test Should Be Ignored"
);
}
void
spec_ThisTestPassesWhenNormalSetupRan
(
void
)
{
TEST_ASSERT_EQUAL_MESSAGE
(
1
,
CounterSetup
,
"Normal Setup Wasn't Run"
);
}
void
spec_ThisTestPassesWhenNormalTeardownRan
(
void
)
{
TEST_ASSERT_EQUAL_MESSAGE
(
1
,
CounterTeardown
,
"Normal Teardown Wasn't Run"
);
}
test/tests/test_generate_test_runner.rb
浏览文件 @
57676b5e
...
...
@@ -774,6 +774,82 @@ RUNNER_TESTS = [
}
},
{
:name
=>
'ArgsNameFilterWithWildcardOnFile'
,
:testfile
=>
'testdata/testRunnerGeneratorSmall.c'
,
:testdefines
=>
[
'TEST'
,
'UNITY_USE_COMMAND_LINE_ARGS'
],
:options
=>
{
:cmdline_args
=>
true
,
},
:cmdline_args
=>
"-n testRunnerGeneratorSma*"
,
:expected
=>
{
:to_pass
=>
[
'test_ThisTestAlwaysPasses'
,
'spec_ThisTestPassesWhenNormalSetupRan'
,
'spec_ThisTestPassesWhenNormalTeardownRan'
],
:to_fail
=>
[
'test_ThisTestAlwaysFails'
],
:to_ignore
=>
[
'test_ThisTestAlwaysIgnored'
],
}
},
{
:name
=>
'ArgsNameFilterWithWildcardAsName'
,
:testfile
=>
'testdata/testRunnerGeneratorSmall.c'
,
:testdefines
=>
[
'TEST'
,
'UNITY_USE_COMMAND_LINE_ARGS'
],
:options
=>
{
:cmdline_args
=>
true
,
},
:cmdline_args
=>
"-n testRunnerGeneratorSmall:*"
,
:expected
=>
{
:to_pass
=>
[
'test_ThisTestAlwaysPasses'
,
'spec_ThisTestPassesWhenNormalSetupRan'
,
'spec_ThisTestPassesWhenNormalTeardownRan'
],
:to_fail
=>
[
'test_ThisTestAlwaysFails'
],
:to_ignore
=>
[
'test_ThisTestAlwaysIgnored'
],
}
},
{
:name
=>
'ArgsNameFilterWithWildcardOnName'
,
:testfile
=>
'testdata/testRunnerGeneratorSmall.c'
,
:testdefines
=>
[
'TEST'
,
'UNITY_USE_COMMAND_LINE_ARGS'
],
:options
=>
{
:cmdline_args
=>
true
,
},
:cmdline_args
=>
"-n testRunnerGeneratorSmall:test_*"
,
:expected
=>
{
:to_pass
=>
[
'test_ThisTestAlwaysPasses'
],
:to_fail
=>
[
'test_ThisTestAlwaysFails'
],
:to_ignore
=>
[
'test_ThisTestAlwaysIgnored'
],
}
},
{
:name
=>
'ArgsNameFilterWithWildcardAndShortName'
,
:testfile
=>
'testdata/testRunnerGeneratorSmall.c'
,
:testdefines
=>
[
'TEST'
,
'UNITY_USE_COMMAND_LINE_ARGS'
],
:options
=>
{
:cmdline_args
=>
true
,
},
:cmdline_args
=>
"-n testRunnerGeneratorSmall:te*"
,
:expected
=>
{
:to_pass
=>
[
'test_ThisTestAlwaysPasses'
],
:to_fail
=>
[
'test_ThisTestAlwaysFails'
],
:to_ignore
=>
[
'test_ThisTestAlwaysIgnored'
],
}
},
{
:name
=>
'ArgsNameFilterWithWildcardOnBoth'
,
:testfile
=>
'testdata/testRunnerGeneratorSmall.c'
,
:testdefines
=>
[
'TEST'
,
'UNITY_USE_COMMAND_LINE_ARGS'
],
:options
=>
{
:cmdline_args
=>
true
,
},
:cmdline_args
=>
"-n testRunnerGeneratorSm*:*"
,
:expected
=>
{
:to_pass
=>
[
'test_ThisTestAlwaysPasses'
,
'spec_ThisTestPassesWhenNormalSetupRan'
,
'spec_ThisTestPassesWhenNormalTeardownRan'
],
:to_fail
=>
[
'test_ThisTestAlwaysFails'
],
:to_ignore
=>
[
'test_ThisTestAlwaysIgnored'
],
}
},
{
:name
=>
'ArgsExcludeFilterJustTest'
,
:testfile
=>
'testdata/testRunnerGenerator.c'
,
:testdefines
=>
[
'TEST'
,
'UNITY_USE_COMMAND_LINE_ARGS'
],
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录