{"id":16851915,"url":"https://github.com/cad97/conformance","last_synced_at":"2025-10-18T06:04:05.160Z","repository":{"id":90989585,"uuid":"219580866","full_name":"CAD97/conformance","owner":"CAD97","description":null,"archived":false,"fork":false,"pushed_at":"2019-11-04T19:33:05.000Z","size":12,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-24T16:10:28.784Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CAD97.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","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-11-04T19:32:38.000Z","updated_at":"2019-11-04T19:33:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"5820bcbd-7933-46f4-8d6c-24c22d48a6d8","html_url":"https://github.com/CAD97/conformance","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CAD97%2Fconformance","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CAD97%2Fconformance/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CAD97%2Fconformance/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CAD97%2Fconformance/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CAD97","download_url":"https://codeload.github.com/CAD97/conformance/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244196783,"owners_count":20414369,"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","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-13T13:34:06.928Z","updated_at":"2025-10-18T06:04:05.020Z","avatar_url":"https://github.com/CAD97.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Conformance tests made simple\n\nExample test file:\n\n```\n\n=========\ntest name\noptional test description\n=========\ntest input\n=========\ntest output\n=========\n\n============\nanother test\nthe fences must all be the same length\n============\nthis input is what is passed to your function (including trailing newline)\nthe single newline after the leading fence is stripped\n============\ntest output is any serde data format\nit is normalized before comparison\n============\n```\n\nTests are typically dispatched through the standard test harness:\n\n```rust\nuse { conformance, serde, serde_yaml as yaml };\n\n#[conformance::test(exact, serde=yaml, file=\"tests/example.test\")]\nfn example_test(s: \u0026str) -\u003e impl serde::Serialize {\n    // Do the transformation that you want to test.\n    // The output type can be any type that implements Serialize.\n    // The function remains and can be used by other code!\n    // You can also attach multiple `conformance::test` attributes to one fn. \n}\n```\n\nThe arguments to `conformance::tests`:\n\n- `exact`: the mode to match in. Only `exact` is currently supported.\n  The generated and expected output must match exactly (after normalization).\n- `serde`: the data format to target. Stands in for three arguments, `ser`, `de`, and `value`.\n  Instead of `serde`, you can provide just `ser`, `de`, and optionally `value`,\n  or you can override any of `ser`/`de`/`value` after providing `serde`.\n    - `ser`: path to a function of shape `fn\u003cT\u003e(\u0026T) -\u003e Result\u003cString, impl Error\u003e`.\n      Default: `#serde::to_string`.\n    - `de`: path to a function of shape `fn\u003cT\u003e(\u0026str) -\u003e Result\u003cT, impl Error\u003e`.\n      Default: `#serde::from_str`.\n    - `value`: a type that can be deserialized from the expected output.\n      Default: `#serde::Value`, or the annotated function's return type if `serde` is not provided.\n- `file`: A filesystem path relative to `Cargo.toml` to the test file.\n  Can also be `glob` to enable [glob paths](https://docs.rs/glob/).\n\nSetting the environment variable `CONFORMANCE_BLESS` will cause tests to\noverwrite the expected output if it does not match with the produced output.\n(They will still fail on the first run, however.)\u003csup\u003e†\u003c/sup\u003e\n\nBy default, all test file reading and parsing is done at compile time.\nIf this is not desired, you can enable the `runtime` feature\u003csup\u003e†\u003c/sup\u003e.\nThis adds two new attributes, `conformance::test_case`, which has all the same\narguments as `conformance::test`, and `conformance::main`, which is used to\ncollect all of your test cases and generate a test runner for them:\n\n```rust\n#[conformance::test_case(exact, serde=yaml, file=\"tests/example.test\")]\nfn example_test_case(s: \u0026str) -\u003e impl serde::Serialize {\n    // Do the transformation that you want to test.\n    // The output type can be any type that implements Serialize.\n    // Only one `conformance::test_case` attribute can be attached to a fn;\n    // the function item is replaced with a static `conformance::TestCase`.\n}\n\n#[conformance::main]\nstatic TESTS: \u0026[conformance::TestCase] = \u0026[example_test_case];\n```\n\n## License\n\nLicensed under either of\n\n * Apache License, Version 2.0\n   ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n * MIT license\n   ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\nIf you are a highly paid worker at any company that prioritises profit over\npeople, you can still use this crate. I simply wish you will unionise and push\nback against the obsession for growth, control, and power that is rampant in\nyour workplace. Please take a stand against the horrible working conditions\nthey inflict on your lesser paid colleagues, and more generally their gross\ndisrespect for the very human rights they claim to fight for.\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be\ndual licensed as above, without any additional terms or conditions.\n\n---\n\n\u003csup\u003e†\u003c/sup\u003e Not yet implemented\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcad97%2Fconformance","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcad97%2Fconformance","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcad97%2Fconformance/lists"}