cppreference-doc
cppreference-doc copied to clipboard
Testing the code examples
I did a Lua script to extract the code examples and test then here https://github.com/robertoraggi/cplusplus/issues/314 to test it's independent parser https://github.com/robertoraggi/cplusplus and other parsers as well like g++ and clang .
Around 5% of the examples fail (some are due to missing include files or the libstdc++ installed on my Ubuntu 18.04).
If this project doesn't have a script to test the code examples you can use/adapt it .
See here https://github.com/tree-sitter/tree-sitter-cpp/issues/243 for a script using tree-sitter and Lua to check for errors on the documentation like the ones bellow:
- https://en.cppreference.com/w/cpp/algorithm/bsearch: missing semi column at line:31:71
- https://en.cppreference.com/w/cpp/algorithm/execution_policy_tag: extra semi column at line:26:2
- https://en.cppreference.com/w/cpp/algorithm/generate: extra semi column at line:10:2
- https://en.cppreference.com/w/cpp/algorithm/generate: extra semi column at line:22:2
- https://en.cppreference.com/w/cpp/algorithm/partial_sort: extra semi column at line:26:2
- https://en.cppreference.com/w/cpp/container/span/last: extra semi column at line:11:2
- https://en.cppreference.com/w/cpp/container/unordered_map/max_bucket_count: extra semi column at line:6:86