{"id":16661145,"url":"https://github.com/sjakobi/hspec-parsec","last_synced_at":"2025-07-23T20:02:14.689Z","repository":{"id":62436197,"uuid":"204083138","full_name":"sjakobi/hspec-parsec","owner":"sjakobi","description":"Hspec expectations for testing Parsec parsers","archived":false,"fork":false,"pushed_at":"2019-08-24T01:03:57.000Z","size":5,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-04-26T15:22:51.461Z","etag":null,"topics":["haskell","hspec","parsec","parsing","testing"],"latest_commit_sha":null,"homepage":null,"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/sjakobi.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":"2019-08-23T23:26:44.000Z","updated_at":"2019-12-05T09:55:35.000Z","dependencies_parsed_at":"2022-11-01T20:46:09.645Z","dependency_job_id":null,"html_url":"https://github.com/sjakobi/hspec-parsec","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjakobi%2Fhspec-parsec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjakobi%2Fhspec-parsec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjakobi%2Fhspec-parsec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjakobi%2Fhspec-parsec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sjakobi","download_url":"https://codeload.github.com/sjakobi/hspec-parsec/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243293766,"owners_count":20268139,"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":["haskell","hspec","parsec","parsing","testing"],"created_at":"2024-10-12T10:33:49.943Z","updated_at":"2025-03-12T20:50:25.553Z","avatar_url":"https://github.com/sjakobi.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hspec-parsec\n\n[![License BSD3](https://img.shields.io/badge/license-BSD3-brightgreen.svg)](http://opensource.org/licenses/BSD-3-Clause)\n[![Hackage](https://img.shields.io/hackage/v/hspec-parsec.svg?style=flat)](https://hackage.haskell.org/package/hspec-parsec)\n\nThis package provides handy [Hspec](http://hspec.github.io/) expectations for testing\n[Parsec](http://hackage.haskell.org/package/parsec) parsers.\n\n## Usage\n\nAdd `hspec-parsec` to your test suite's dependencies:\n\n```\n  build-depends:       base\n                     , hspec\n                     , hspec-parsec\n                     , parsec\n```\n\n… write some tests:\n\n```haskell\nimport Test.Hspec\nimport Test.Hspec.Parsec\nimport Text.Parsec\nimport Text.Parsec.String (Parser)\n\nmain :: IO ()\nmain = hspec $ do\n  describe \"yamlBool\" $ do\n    let yamlBool' = parse yamlBool \"\"\n\n    it \"correctly parses \\\"True\\\"\" $ do\n      yamlBool' \"True\" `shouldParse` True\n\n    it \"doesn't parse \\\"yes\\\"\" $ do\n      yamlBool' `shouldFailOn` \"yes\"\n\nyamlBool :: Parser Bool\nyamlBool = \n        (choice (map string false) *\u003e pure False)\n    \u003c|\u003e (choice (map string true) *\u003e pure True)\n  where\n    false = [\"false\", \"False\", \"FALSE\"]\n    true = [\"true\", \"True\", \"TRUE\"]\n```\n\n… and run them:\n\n```shell\n$ stack test\nhspec-parsec\u003e test (suite: spec)\n\n\nyamlBool\n  correctly parses \"True\"\n  doesn't parse \"yes\"\n\nFinished in 0.0001 seconds\n2 examples, 0 failures\n\nhspec-parsec\u003e Test suite spec passed\n```\n\n## Development status and contributing\n\nThis package is currently very limited. If you need more functionality or want to\ncontribute in some other way, you're welcome to open an issue or make a PR! :)\n\n## Thanks\n\n… to [Mark Karpov](https://github.com/mrkkrp), whose package\n[`hspec-megaparsec`](https://hackage.haskell.org/package/hspec-megaparsec)\nmuch inspired `hspec-parsec`!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsjakobi%2Fhspec-parsec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsjakobi%2Fhspec-parsec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsjakobi%2Fhspec-parsec/lists"}