{"id":13492938,"url":"https://github.com/csicar/purescript-doctest","last_synced_at":"2026-01-12T02:42:16.589Z","repository":{"id":47432525,"uuid":"260571442","full_name":"csicar/purescript-doctest","owner":"csicar","description":"Generate tests from examples in purescript docs","archived":false,"fork":false,"pushed_at":"2022-12-11T18:08:36.000Z","size":8690,"stargazers_count":15,"open_issues_count":4,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T12:34:34.458Z","etag":null,"topics":["purescript"],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/csicar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-01T22:35:15.000Z","updated_at":"2021-09-14T21:42:28.000Z","dependencies_parsed_at":"2023-01-27T04:30:53.855Z","dependency_job_id":null,"html_url":"https://github.com/csicar/purescript-doctest","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csicar%2Fpurescript-doctest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csicar%2Fpurescript-doctest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csicar%2Fpurescript-doctest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csicar%2Fpurescript-doctest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/csicar","download_url":"https://codeload.github.com/csicar/purescript-doctest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246020827,"owners_count":20710827,"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":["purescript"],"created_at":"2024-07-31T19:01:10.614Z","updated_at":"2026-01-12T02:42:16.549Z","avatar_url":"https://github.com/csicar.png","language":"Haskell","readme":"Purepur\n=======\n\nGenerate tests from examples in your purescript-docs.\n\nGiven:\n```purescript\nmodule Data.Array exposing …\n\n-- | Convert a `Foldable` structure into an `Array`.\n-- |\n-- | ```purescript run\n-- | \u003e fromFoldable (Just 1)\n-- | [1]\n-- | ```\n-- |\nfromFoldable :: forall f. Foldable f =\u003e f ~\u003e Array\nfromFoldable = fromFoldableImpl foldr\n```\npurepur will generate:\n```purescript\nmodule Test.Example.Data.Array where \n\n…\n\nmain :: Spec Unit\nmain = describe \"ArrayEx\" $ do \n    it \"value spec in docs from:fromFoldable\" $ show (fromFoldable (Just 1)) `shouldEqual` \"[1]\"\n```\n\nUsage\n------\n\nFor purepur to recognize an example as a test, add ` ```purescript run` to a comment in your purescript code, like shown here https://github.com/csicar/purescript-purepur/blob/master/example/src/ArrayEx.purs#L11.\nThe syntax of the code-fence is identical to that of PSCI. This means that copying the terminal output from PSCI to a docs comment _should_ directly work.\n\nNow generate the test-files:\n\n`purepure -o test/docs --src \"src/**/*.purs\" --src \"./README.md\" $(spago sources)`\n\n- `-o` specifies the directory, where the test-files should be written to\n- `--src` specified the glob, for which tests should be generated.\n\nNow `test/docs` should look similar to this: https://github.com/csicar/purescript-purepur/blob/master/example/test/docs\n\nIn addition to the normal PSCI-Syntax, purepur allows __multiline__ expressions and declarations:\n\n\n    ```purescript run\n    \u003e f x = \n        x + 1\n    \u003e f 2\n    3\n    ```\n\n\nBuilding\n--------\n\n```bash\ngit clone …\ncd …\nstack install\n```\n\nTesting\n-----\n\nrun in `example`\n\n```bash\nstack run -- -o test/docs --src \"src/**/*.purs\" (spago sources)\n```\n\n\nThe project is forked from https://github.com/andyarvanitis/purescript-native\n","funding_links":[],"categories":["Uncategorized","Haskell"],"sub_categories":["Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsicar%2Fpurescript-doctest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcsicar%2Fpurescript-doctest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsicar%2Fpurescript-doctest/lists"}