Skip to content

Commit 9f7daac

Browse files
authored
Merge pull request #2195 from strictdoc-project/stanislaw/eol
tests: sdoc_source_code: test for reading markers with underscores
2 parents 634312c + 80ec309 commit 9f7daac

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

tests/unit/strictdoc/backend/sdoc_source_code/readers/test_reader_c.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,52 @@ def test_03_functions_multiline():
128128
assert info.markers[1].ng_range_line_end == 22
129129
assert info.markers[1].reqs_objs[0].ng_source_line == 17
130130
assert info.markers[1].reqs_objs[0].ng_source_column == 14
131+
132+
133+
def test_04_multiline_markers_with_underscores():
134+
"""
135+
Bug: requirements UID not detected in source code when there's an EOL #2130
136+
https://github.com/strictdoc-project/strictdoc/issues/2130
137+
"""
138+
139+
input_string = b"""\
140+
#include <stdio.h>
141+
142+
/**
143+
* @brief some text
144+
* @return some text.
145+
* @param[in] void
146+
* @param[out] void
147+
* @param[in, out] void
148+
* @pre
149+
* @post
150+
* @relation{INT_STP_016_0000, INT_STP_016_0001, INT_STP_016_0002,
151+
* scope=function}
152+
* @note Reference:
153+
*/
154+
stilib_result_t stilib_smu_start_state_check(void);
155+
"""
156+
157+
reader = SourceFileTraceabilityReader_C()
158+
159+
info: SourceFileTraceabilityInfo = reader.read(
160+
input_string, file_path="foo.c"
161+
)
162+
163+
assert isinstance(info, SourceFileTraceabilityInfo)
164+
assert len(info.markers) == 1
165+
assert info.markers[0].reqs == [
166+
"INT_STP_016_0000",
167+
"INT_STP_016_0001",
168+
"INT_STP_016_0002",
169+
]
170+
171+
assert info.markers[0].ng_source_line_begin == 11
172+
assert info.markers[0].ng_range_line_begin == 3
173+
assert info.markers[0].ng_range_line_end == 15
174+
assert info.markers[0].reqs_objs[0].ng_source_line == 11
175+
assert info.markers[0].reqs_objs[0].ng_source_column == 14
176+
assert info.markers[0].reqs_objs[1].ng_source_line == 11
177+
assert info.markers[0].reqs_objs[1].ng_source_column == 32
178+
assert info.markers[0].reqs_objs[2].ng_source_line == 11
179+
assert info.markers[0].reqs_objs[2].ng_source_column == 50

0 commit comments

Comments
 (0)