chore(cpp): configure CI to extract and execute C++ code from Markdo…#3381
Open
Tyooughtul wants to merge 3 commits intoapache:mainfrom
Open
chore(cpp): configure CI to extract and execute C++ code from Markdo…#3381Tyooughtul wants to merge 3 commits intoapache:mainfrom
Tyooughtul wants to merge 3 commits intoapache:mainfrom
Conversation
…wn files - add extract_cpp_doc_examples.py to extract C++ code blocks from markdown - integrate doc tests into CI with --skip-doc-tests and --doc-tests-only options - fix documentation bugs discovered by tests: - index.md: change class to struct for aggregate initialization - field-configuration.md: fix smart pointer access using .get() - add cpp/doc_tests/ to .gitignore issue: apache#658
chaokunyang
reviewed
Feb 20, 2026
|
|
||
| // Define a struct | ||
| class Person { | ||
| struct Person { |
Collaborator
There was a problem hiding this comment.
Why we need this change?
Author
There was a problem hiding this comment.
I think the issue is that class members are private by default, but the code uses aggregate initialization Person{"Alice", 30, ...} . As far as I understand, aggregate initialization requires all members to be public, so I changed it to struct .
chaokunyang
reviewed
Feb 20, 2026
| doc.metadata = nullptr; // Allowed because nullable | ||
| doc.parent = std::make_shared<Document>(); | ||
| doc.parent->title = "Parent Doc"; | ||
| doc.parent.get()->title = "Parent Doc"; |
Collaborator
There was a problem hiding this comment.
is this really necessary?
Author
There was a problem hiding this comment.
I think fory::field<std::shared_ptr>::operator->() returns a pointer to the shared_ptr itself, not to T . Using .get() gives us the shared_ptr reference, and then -> properly accesses the underlying object.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
issue: #658
Why?
Add automated testing for C++ code examples in documentation to ensure they compile and run correctly.
What does this PR do?
Related issues