File tree Expand file tree Collapse file tree 6 files changed +126
-0
lines changed
tests/integration/features/source_code_traceability/_source_nodes/11_functions_without_fields_do_not_generate_node Expand file tree Collapse file tree 6 files changed +126
-0
lines changed Original file line number Diff line number Diff line change @@ -647,6 +647,9 @@ def create_folder_section(
647647 current_top_node = section_cache [path_component_ ]
648648
649649 for source_node_ in traceability_info_ .source_nodes :
650+ if len (source_node_ .fields ) == 0 :
651+ continue
652+
650653 assert source_node_ .entity_name is not None
651654 source_sdoc_node_uid = f"{ document_uid } /{ path_to_source_file_ } /{ source_node_ .entity_name } "
652655
Original file line number Diff line number Diff line change 1+ [DOCUMENT]
2+ MID: c2d4542d5f1741c88dfcb4f68ad7dcbd
3+ TITLE: Test specification
4+ UID: TEST_DOC
5+
6+ [GRAMMAR]
7+ ELEMENTS:
8+ - TAG: SECTION
9+ PROPERTIES:
10+ IS_COMPOSITE: True
11+ FIELDS:
12+ - TITLE: UID
13+ TYPE: String
14+ REQUIRED: False
15+ - TITLE: TITLE
16+ TYPE: String
17+ REQUIRED: True
18+ - TAG: TEST_SPEC
19+ PROPERTIES:
20+ VIEW_STYLE: Narrative
21+ FIELDS:
22+ - TITLE: UID
23+ TYPE: String
24+ REQUIRED: False
25+ - TITLE: TITLE
26+ TYPE: String
27+ REQUIRED: True
28+ - TITLE: INTENTION
29+ TYPE: String
30+ REQUIRED: False
31+ - TITLE: INPUT
32+ TYPE: String
33+ REQUIRED: False
34+ - TITLE: EXPECTED_RESULTS
35+ TYPE: String
36+ REQUIRED: False
37+ RELATIONS:
38+ - TYPE: Parent
39+ - TYPE: File
Original file line number Diff line number Diff line change 1+ [DOCUMENT]
2+ TITLE: Hello world doc
3+
4+ [REQUIREMENT]
5+ UID: REQ-1
6+ TITLE: Requirement Title
7+ STATEMENT: Requirement Statement
8+
9+ [REQUIREMENT]
10+ UID: REQ-2
11+ TITLE: Requirement Title #2
12+ STATEMENT: Requirement Statement #2
Original file line number Diff line number Diff line change 1+ [project ]
2+
3+ features = [
4+ " REQUIREMENT_TO_SOURCE_TRACEABILITY" ,
5+ " SOURCE_FILE_LANGUAGE_PARSERS" ,
6+ ]
7+
8+ source_nodes = [
9+ { "tests/" = { uid = " TEST_DOC" , node_type = " TEST_SPEC" } }
10+ ]
11+
12+ exclude_source_paths = [
13+ " test.itest"
14+ ]
Original file line number Diff line number Diff line change 1+ #
2+ # This test verifies that only functions that have at least one annotated field
3+ # get an auto-generated SDoc node, while plain comments without field annotation
4+ # don't cause auto-generation. Relation markers don't count as field annotation
5+ # and shall work as usual.
6+ #
7+ # @relation(SDOC-SRS-141, scope=file)
8+ #
9+
10+ RUN: %strictdoc export %S --output-dir %T | filecheck %s
11+
12+ CHECK: Published: Hello world doc
13+
14+ RUN: %check_exists --file "%T/html/_source_files/tests/file.c.html"
15+
16+ RUN: %cat %T/html/%THIS_TEST_FOLDER/input.html | filecheck %s --check-prefix CHECK-HTML
17+ CHECK-HTML: TEST_DOC/tests/file.c/test_case_1
18+ CHECK-HTML: tests/file.c, <i>lines: 3-20</i>, function test_case_1()
19+ # relation markers shall still work, but no link to auto-generated shall be there
20+ CHECK-HTML-NOT: TEST_DOC/tests/file.c/test_case_2
21+ CHECK-HTML: tests/file.c, <i>lines: 22-29</i>, function test_case_2()
22+
23+ RUN: %cat %T/html/%THIS_TEST_FOLDER/description.html | filecheck %s --check-prefix CHECK-HTML-TESTSPEC
24+ CHECK-HTML-TESTSPEC: test_case_1
25+ CHECK-HTML-TESTSPEC-NOT: test_case_2
26+
27+ # test_case_2 shall still count as covered, since it has a relation marker
28+ RUN: %cat %T/html/source_coverage.html | filecheck %s --check-prefix CHECK-SOURCE-COVERAGE
29+ CHECK-SOURCE-COVERAGE: 96.3
Original file line number Diff line number Diff line change 1+ #include <stdio.h>
2+
3+ /**
4+ * Some text.
5+ *
6+ * @relation(REQ-1, scope=function)
7+ *
8+ * INTENTION: Intention...
9+ *
10+ * INPUT: This
11+ * is
12+ * a statement
13+ * \n\n
14+ * And this is the same statement's another paragraph.
15+ *
16+ * EXPECTED_RESULTS: This is a comment.
17+ */
18+ void test_case_1 (void ) {
19+ print ("hello world\n" );
20+ }
21+
22+ /**
23+ * Plain documentation, no fields. Don't auto-generate a SDoc node for this function.
24+ *
25+ * @relation(REQ-2, scope=function)
26+ */
27+ void test_case_2 (void ) {
28+ print ("hello world\n" );
29+ }
You can’t perform that action at this time.
0 commit comments