{"id":16795190,"url":"https://github.com/abonander/readme-doctest-poc","last_synced_at":"2026-03-14T21:40:59.558Z","repository":{"id":66138848,"uuid":"167110259","full_name":"abonander/readme-doctest-poc","owner":"abonander","description":"Automatically test Rust code examples in your README","archived":false,"fork":false,"pushed_at":"2019-01-23T21:07:48.000Z","size":8,"stargazers_count":21,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-21T03:03:02.098Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abonander.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-23T03:25:46.000Z","updated_at":"2023-12-27T13:28:29.000Z","dependencies_parsed_at":"2023-03-10T23:39:47.999Z","dependency_job_id":null,"html_url":"https://github.com/abonander/readme-doctest-poc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/abonander/readme-doctest-poc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abonander%2Freadme-doctest-poc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abonander%2Freadme-doctest-poc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abonander%2Freadme-doctest-poc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abonander%2Freadme-doctest-poc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abonander","download_url":"https://codeload.github.com/abonander/readme-doctest-poc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abonander%2Freadme-doctest-poc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273377158,"owners_count":25094528,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-02T02:00:09.530Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T09:15:39.378Z","updated_at":"2026-03-14T21:40:59.452Z","avatar_url":"https://github.com/abonander.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"README Doctest PoC ![](https://img.shields.io/travis/abonander/readme-doctest-poc.svg)\n------------------\n\nThe following code block is tested automatically. \n\n```rust\nuse readme_doctest_poc::foo;\n\nassert_eq!(foo(), 65536);\n```\n\nDon't believe me? Clone this repo and run `cargo test`, see that it passes. Change the value and the test fails.\n\nNo external tools, no config, no codegen required. See [`src/lib.rs`](src/lib.rs) for how it's done. It is actually that simple!\n\n### How It Works\nThe reasoning is pretty straightforward. Thanks to [RFC 1990](https://github.com/rust-lang/rust/issues/44732), \nwe now have the ability to import external Markdown files as documentation for items. The original idea\nis to move long-form documentation out of code but still allow Rustdoc to render it in-line.\n\nThe implementation of this RFC includes the ability to test code blocks just like in inline code documentation,\nwhich you can read more about in [the Rustdoc guide](https://doc.rust-lang.org/rustdoc/documentation-tests.html).\n\nSince doctests are still run for private items, you can use this to test code examples in your README without\nhaving to render it in your docs (since you might not want your README and your crate docs to have all the same content).\n\n### Limitations/Downsides (as of January 22, 2019)\n\n* The `external_doc` feature is unstable (mostly due to the following reason), so it requires nightly. \nHowever, this works with `cfg_attr` so you could hide it behind a Cargo feature and run it in nightly on CI.\n\n\n* Test failures only report the line of the `#[doc(include = \"..\")]` attribute so fixing test failures\nisn't exactly going to be fun.\n\n... That's about it, actually! It's criminal that more people don't know about this. The `external_doc` feature needs a kick\nin the pants to get stabilized so more people can benefit from this as well as its intended uses.\n\n### License / Contributing\nThis work is released to the public domain. Any contribution intentionally submitted for inclusion shall also be released \nto the public domain.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabonander%2Freadme-doctest-poc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabonander%2Freadme-doctest-poc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabonander%2Freadme-doctest-poc/lists"}