{"id":26601342,"url":"https://github.com/philippmdoerner/mockingbird","last_synced_at":"2025-07-25T07:39:11.381Z","repository":{"id":109539008,"uuid":"582662913","full_name":"PhilippMDoerner/mockingbird","owner":"PhilippMDoerner","description":"A package to mock procedures and functions without turning it all into OOP.","archived":false,"fork":false,"pushed_at":"2022-12-31T12:34:55.000Z","size":69,"stargazers_count":14,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-09T16:45:50.875Z","etag":null,"topics":["mocking-library","nim-lang","nimscript","testing","unit-testing"],"latest_commit_sha":null,"homepage":"","language":"Nim","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/PhilippMDoerner.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":"2022-12-27T14:08:59.000Z","updated_at":"2024-09-12T13:20:42.000Z","dependencies_parsed_at":"2023-04-13T14:32:24.958Z","dependency_job_id":null,"html_url":"https://github.com/PhilippMDoerner/mockingbird","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/PhilippMDoerner/mockingbird","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhilippMDoerner%2Fmockingbird","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhilippMDoerner%2Fmockingbird/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhilippMDoerner%2Fmockingbird/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhilippMDoerner%2Fmockingbird/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PhilippMDoerner","download_url":"https://codeload.github.com/PhilippMDoerner/mockingbird/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhilippMDoerner%2Fmockingbird/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266974748,"owners_count":24014992,"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-07-25T02:00:09.625Z","response_time":70,"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":["mocking-library","nim-lang","nimscript","testing","unit-testing"],"created_at":"2025-03-23T18:39:22.943Z","updated_at":"2025-07-25T07:39:11.339Z","avatar_url":"https://github.com/PhilippMDoerner.png","language":"Nim","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1\u003e This Package is not finished \u003c/h1\u003e\n\n#### _Who's mocking who now?_\n\nThis is yet another mocking library.\nUnlike other mocking libraries, this one allows you to keep your module structure as it is! \nJust add the `{.mockable.}` pragma to your exported procs, compile with the `--define:mock` flag and you're good to go!\n\nThe pragma turns any proc annotated with it into a variable that can be assigned to.\nYou can then \"mock\" procs by simply assigning a different procedure to that variable.\n\n**Note: This currently does not work with generics! I'm looking into how to get there but it's hard**\n\n# Example\n```nim\n# get5Module.nim\nproc get5*(): int {.mockable.} = 5 # Can be replaced\n```\n```nim\n# add5Module.nim\nimport ./get5Module\n\nproc add5*(x: int): int = x + get5()\n```\n\n```nim\nimport ./add5Module\nimport ./get5Module\nimport std/[sugar, unittest]\n\n\nsuite \"Test add5\":  \n  # Important for the teardown in order to \"reset\" the mocks\n  let get5Original = get5\n  \n  teardown:\n    get5 = get5Original # \"Resets\" the mock to provide the normal behaviour again\n\n  test \"\"\"\n    Given get5 returns 5\n    When calling add5 with 10\n    Then it should return 15\n  \"\"\":\n    check add5(10) == 15\n\n  test \"\"\"\n    Given get5 returns 10\n    When calling add5 with 10\n    Then it should return 20\n  \"\"\":\n    get5 = () =\u003e 10\n    check add5(10) == 20\n\n  test \"\"\"\n    Given get5 not being mocked and so it should returns 5\n    When calling add5 with 10\n    Then it should return 15 again\n  \"\"\":\n    check add5(10) == 15\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilippmdoerner%2Fmockingbird","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphilippmdoerner%2Fmockingbird","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilippmdoerner%2Fmockingbird/lists"}