Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pugs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
code
pugs
Commits
978e68a4
Commit
978e68a4
authored
4 years ago
by
Stéphane Del Pino
Browse files
Options
Downloads
Patches
Plain Diff
Add tests for ParseError
parent
0d067c5a
No related branches found
No related tags found
1 merge request
!54
Feature/language coverage
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/CMakeLists.txt
+1
-0
1 addition, 0 deletions
tests/CMakeLists.txt
tests/test_ParseError.cpp
+39
-0
39 additions, 0 deletions
tests/test_ParseError.cpp
with
40 additions
and
0 deletions
tests/CMakeLists.txt
+
1
−
0
View file @
978e68a4
...
...
@@ -69,6 +69,7 @@ add_executable (unit_tests
test_ListAffectationProcessor.cpp
test_NameProcessor.cpp
test_OStreamProcessor.cpp
test_ParseError.cpp
test_PCG.cpp
test_PugsFunctionAdapter.cpp
test_PugsAssert.cpp
...
...
This diff is collapsed.
Click to expand it.
tests/test_ParseError.cpp
0 → 100644
+
39
−
0
View file @
978e68a4
#include
<catch2/catch.hpp>
#include
<language/utils/ParseError.hpp>
#include
<string>
// clazy:excludeall=non-pod-global-static
TEST_CASE
(
"ParseError"
,
"[language]"
)
{
SECTION
(
"single position"
)
{
const
std
::
string
source
=
R"(
a first line
a second line
)"
;
TAO_PEGTL_NAMESPACE
::
internal
::
iterator
i
(
&
source
[
0
],
3
,
1
,
2
);
TAO_PEGTL_NAMESPACE
::
position
p
{
i
,
source
};
ParseError
parse_error
(
"error message"
,
p
);
REQUIRE
(
parse_error
.
positions
()
==
std
::
vector
{
p
});
REQUIRE
(
parse_error
.
what
()
==
std
::
string
{
"error message"
});
}
SECTION
(
"position list"
)
{
const
std
::
string
source
=
R"(
a first line
a second line
)"
;
TAO_PEGTL_NAMESPACE
::
internal
::
iterator
i0
(
&
source
[
0
],
3
,
1
,
2
);
TAO_PEGTL_NAMESPACE
::
position
p0
{
i0
,
source
};
TAO_PEGTL_NAMESPACE
::
internal
::
iterator
i1
(
&
source
[
0
],
4
,
1
,
3
);
TAO_PEGTL_NAMESPACE
::
position
p1
{
i1
,
source
};
ParseError
parse_error
(
"error message"
,
std
::
vector
{
p0
,
p1
});
REQUIRE
(
parse_error
.
positions
()
==
std
::
vector
{
p0
,
p1
});
REQUIRE
(
parse_error
.
what
()
==
std
::
string
{
"error message"
});
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment