Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
86b85492
Unverified
Commit
86b85492
authored
Jun 03, 2020
by
Patrick Steinhardt
Committed by
GitHub
Jun 03, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5537 from libgit2/ethomson/clar_exactmatch
tests: offer exact name matching with a `$` suffix
parents
53a8f463
0d3ce2ac
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
tests/clar.c
+9
-0
No files found.
tests/clar.c
View file @
86b85492
...
@@ -293,6 +293,7 @@ clar_run_suite(const struct clar_suite *suite, const char *filter)
...
@@ -293,6 +293,7 @@ clar_run_suite(const struct clar_suite *suite, const char *filter)
const
struct
clar_func
*
test
=
suite
->
tests
;
const
struct
clar_func
*
test
=
suite
->
tests
;
size_t
i
,
matchlen
;
size_t
i
,
matchlen
;
struct
clar_report
*
report
;
struct
clar_report
*
report
;
int
exact
=
0
;
if
(
!
suite
->
enabled
)
if
(
!
suite
->
enabled
)
return
;
return
;
...
@@ -317,6 +318,11 @@ clar_run_suite(const struct clar_suite *suite, const char *filter)
...
@@ -317,6 +318,11 @@ clar_run_suite(const struct clar_suite *suite, const char *filter)
while
(
*
filter
==
':'
)
while
(
*
filter
==
':'
)
++
filter
;
++
filter
;
matchlen
=
strlen
(
filter
);
matchlen
=
strlen
(
filter
);
if
(
matchlen
&&
filter
[
matchlen
-
1
]
==
'$'
)
{
exact
=
1
;
matchlen
--
;
}
}
}
}
}
...
@@ -324,6 +330,9 @@ clar_run_suite(const struct clar_suite *suite, const char *filter)
...
@@ -324,6 +330,9 @@ clar_run_suite(const struct clar_suite *suite, const char *filter)
if
(
filter
&&
strncmp
(
test
[
i
].
name
,
filter
,
matchlen
))
if
(
filter
&&
strncmp
(
test
[
i
].
name
,
filter
,
matchlen
))
continue
;
continue
;
if
(
exact
&&
strlen
(
test
[
i
].
name
)
!=
matchlen
)
continue
;
_clar
.
active_test
=
test
[
i
].
name
;
_clar
.
active_test
=
test
[
i
].
name
;
report
=
calloc
(
1
,
sizeof
(
struct
clar_report
));
report
=
calloc
(
1
,
sizeof
(
struct
clar_report
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment