{"id":16147948,"url":"https://github.com/alexf91/ltest","last_synced_at":"2025-09-22T19:05:15.710Z","repository":{"id":167485670,"uuid":"468619162","full_name":"alexf91/LTest","owner":"alexf91","description":"A unit testing framework for Lean 4","archived":false,"fork":false,"pushed_at":"2023-11-05T04:19:00.000Z","size":155,"stargazers_count":1,"open_issues_count":8,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-06T21:19:46.744Z","etag":null,"topics":["lean","lean4","unit-testing","unittest"],"latest_commit_sha":null,"homepage":"","language":"Lean","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/alexf91.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","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-03-11T05:21:35.000Z","updated_at":"2023-04-01T15:50:01.000Z","dependencies_parsed_at":"2023-05-22T15:30:23.449Z","dependency_job_id":"92ebdffa-aae6-4432-8349-c814d2f2d8cb","html_url":"https://github.com/alexf91/LTest","commit_stats":null,"previous_names":["alexf91/ltest"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alexf91/LTest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexf91%2FLTest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexf91%2FLTest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexf91%2FLTest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexf91%2FLTest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexf91","download_url":"https://codeload.github.com/alexf91/LTest/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexf91%2FLTest/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264757253,"owners_count":23659314,"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":["lean","lean4","unit-testing","unittest"],"created_at":"2024-10-10T00:29:01.496Z","updated_at":"2025-09-22T19:05:10.651Z","avatar_url":"https://github.com/alexf91.png","language":"Lean","funding_links":[],"categories":[],"sub_categories":[],"readme":"**WARNING: This is work in progress**\n\n# Fixture-based test framework for Lean 4\n\n`LTest` uses macros to define testcases and fixtures for testing IO functions in Lean 4.\nIt is heavily inspired by [`pytest`](https://docs.pytest.org/) and [`rstest`](https://docs.rs/rstest).\n\n\n## Fixtures\n\nFixtures are structures with a default state, a setup function and a teardown function.\nThey can depend on other fixtures. The value of dependencies is available in the setup function.\n\nThe following example defines a fixture `NatFixture` with a state of type `Nat` and a value of type `Nat`.\nIt depends on `AnotherFixture`.\n\n```Lean\nfixture NatFixture Nat Nat requires (n : AnotherFixture) where\n  default := 0\n  setup := do\n    -- Do something with n\n    return 0\n  teardown := do return\n```\n\nIn the `setup` function, the state is set to `default`. It can then be changed and queried\nwith the functions of the `StateM` monad (`set`, `get`, ...).\n\n\n## Testcases\n\nTestcases are essentially functions of type `IO Unit`, but they can depend\non fixtures. The value of a setup function is available in a testcases and their\nteardown-function is executed when the test finishes.\n\n```Lean\ntestcase testSomething requires (a : FixtureA) (b : FixtureB) := do\n  -- Do someting with a and b\n  return\n```\n\n\n## Running Tests\n\nFor now, testsuites are compiled and executed as regular programs.\nThe `main` function is created with the `#LTestMain` command, which has to be called exactly once.\nSee the `examples` directory for more information.\n\n```Lean\nimport LTest\n\n#LTestMain\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexf91%2Fltest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexf91%2Fltest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexf91%2Fltest/lists"}