{"id":15750351,"url":"https://github.com/nwtgck/specit-rust","last_synced_at":"2025-06-18T22:41:29.793Z","repository":{"id":47492568,"uuid":"293819706","full_name":"nwtgck/specit-rust","owner":"nwtgck","description":"Smoothly writing test titles in Rust","archived":false,"fork":false,"pushed_at":"2024-07-28T22:29:38.000Z","size":27,"stargazers_count":5,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-04-30T22:45:28.622Z","etag":null,"topics":["rspec","rust","spec","test","testing"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nwtgck.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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":"2020-09-08T13:31:59.000Z","updated_at":"2024-02-26T03:26:00.000Z","dependencies_parsed_at":"2024-07-28T23:32:04.719Z","dependency_job_id":"54b31dbb-b872-4676-984e-c644753c5e8f","html_url":"https://github.com/nwtgck/specit-rust","commit_stats":{"total_commits":34,"total_committers":3,"mean_commits":"11.333333333333334","dds":"0.11764705882352944","last_synced_commit":"32768f91f6eb77f2585630f106c65ea5f9613476"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nwtgck%2Fspecit-rust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nwtgck%2Fspecit-rust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nwtgck%2Fspecit-rust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nwtgck%2Fspecit-rust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nwtgck","download_url":"https://codeload.github.com/nwtgck/specit-rust/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251795390,"owners_count":21645019,"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":["rspec","rust","spec","test","testing"],"created_at":"2024-10-04T06:40:26.014Z","updated_at":"2025-04-30T22:45:30.931Z","avatar_url":"https://github.com/nwtgck.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# specit\n[![Crates.io](https://img.shields.io/crates/v/specit)](https://crates.io/crates/specit) [![CI](https://github.com/nwtgck/specit-rust/workflows/CI/badge.svg)](https://github.com/nwtgck/specit-rust/actions)\n\nSpec \"it\" for Rust testing\n\n## Install\n\n```toml\n# Cargo.toml\n\n[dev-dependencies]\nspecit = \"0.3.0\"\n```\n\n## Usage\n\n```rust\nuse specit::it;\n\n#[it(\"should be correct\")]\nfn t() {\n    assert_eq!(2 + 2, 4);\n}\n\n#[it(\"should be wrong\")]\n#[should_panic]\nfn t() {\n    assert_eq!(1 + 1, 3);\n}\n```\n\nThe test output is like the following.\n\n```\nrunning 2 tests\ntest should_be_correct ... ok\ntest should_be_wrong ... ok\n\ntest result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out\n```\n\n### describe\n\n```rust\nuse specit::describe;\n\n#[describe(\"arithmetic operations\")]\nmod m {\n    use specit::it;\n\n    #[it(\"should add two numbers\")]\n    pub fn t() {\n        assert_eq!(2 + 2, 4);\n    }\n\n    #[it(\"should multiple two numbers\")]\n    pub fn t() {\n        assert_eq!(3 * 3, 9);\n    }\n}\n```\n\nThe test output with `describe` is like the following.\n\n```\nrunning 2 tests\ntest arithmetic_operations::should_add_two_numbers ... ok\ntest arithmetic_operations::should_multiple_two_numbers ... ok\n\ntest result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out\n```\n\n## #[tokio::test] support\n\nYou can test with `#[tokio::test]` for asynchronous functions.\n```rust\nuse specit::it;\n\n#[it(\"should work with tokio::test\")]\n#[tokio::test]\nasync fn t() {\n    let f = async { 10 };\n    assert_eq!(f.await, 10);\n}\n```\n\nYou can get short your code using the following features in each asynchronous runtime.\n\n### `features = [\"tokio\"]`\n\nYou can use `use specit::tokio_it as it` for testing asynchronous functions without `#[tokio::test]` like the following.\n\n```rust\nuse specit::tokio_it as it;\n\n#[it(\"should work with tokio\")]\nasync fn t() {\n    let f = async { 10 };\n    assert_eq!(f.await, 10);\n}\n```\n\n### `features = [\"async-std\"]`\n\nUse `#[it(...)]` instead of `#[async_std::test]` as follows.\n\n```rust\nuse specit::async_std_it as it;\n\n#[it(\"should be correct\")]\nasync fn t() {\n    let f = async { 10 };\n    assert_eq!(f.await, 10);\n}\n```\n\n### `features = [\"lib-wasm-bindgen\"]`\n\nUse `#[it(...)]` instead of `#[wasm_bindgen_test::wasm_bindgen_test]` as follows.\n\n```rust\nuse specit::wasm_bindgen_test_it as it;\nuse wasm_bindgen::prelude::JsValue;\nuse wasm_bindgen_futures::JsFuture;\n\n#[it(\"should be correct\")]\nasync fn t() {\n    let promise = js_sys::Promise::resolve(\u0026JsValue::from(42));\n    let x = JsFuture::from(promise).await.unwrap();\n    assert_eq!(x, 42);\n}\n```\n\n## Internal\n\nInternally, the functions above are `should_be_correct()` and `should_be_wrong()`. You can use any string. Non-alphanum characters are encoded into `'_'`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnwtgck%2Fspecit-rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnwtgck%2Fspecit-rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnwtgck%2Fspecit-rust/lists"}