{"id":37020758,"url":"https://github.com/typelevel/scalaz-scalatest","last_synced_at":"2026-01-14T02:25:34.504Z","repository":{"id":23305439,"uuid":"26664961","full_name":"typelevel/scalaz-scalatest","owner":"typelevel","description":"Scalatest  bindings for scalaz.","archived":true,"fork":false,"pushed_at":"2017-02-19T02:09:09.000Z","size":62,"stargazers_count":23,"open_issues_count":2,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-22T02:57:12.630Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Scala","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/typelevel.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","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":"2014-11-15T01:22:57.000Z","updated_at":"2023-01-28T18:15:49.000Z","dependencies_parsed_at":"2022-08-21T23:10:21.288Z","dependency_job_id":null,"html_url":"https://github.com/typelevel/scalaz-scalatest","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/typelevel/scalaz-scalatest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typelevel%2Fscalaz-scalatest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typelevel%2Fscalaz-scalatest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typelevel%2Fscalaz-scalatest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typelevel%2Fscalaz-scalatest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/typelevel","download_url":"https://codeload.github.com/typelevel/scalaz-scalatest/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typelevel%2Fscalaz-scalatest/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408711,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"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":[],"created_at":"2026-01-14T02:25:33.748Z","updated_at":"2026-01-14T02:25:34.499Z","avatar_url":"https://github.com/typelevel.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"scalaz-scalatest\n================\n\n[![Build Status](https://travis-ci.org/typelevel/scalaz-scalatest.svg?branch=master)](https://travis-ci.org/typelevel/scalaz-scalatest)\n[![codecov.io](https://codecov.io/github/typelevel/scalaz-scalatest/coverage.svg?branch=master)](https://codecov.io/github/typelevel/scalaz-scalatest?branch=master)\n[![scaladoc](https://javadoc-badge.appspot.com/org.typelevel/scalaz-scalatest_2.11.svg?label=scaladoc)](https://javadoc-badge.appspot.com/org.typelevel/scalaz-scalatest_2.11)\n\nScalatest bindings for scalaz.\n\n## Setup\n\nWe currently crossbuild for Scala 2.10, 2.11 \u0026 2.12.\n\n|Scalaz-Scalatest Version | Scalaz Version  | Scalatest Version |\n|-------------------------| --------------  | ----------------- |\n| 0.4.0                   | 7.1.x           | 2.2.6             |\n| 0.5.2                   | 7.1.x           | 3.0.0             |\n| 1.0.0                   | 7.2.x           | 2.2.6             |\n| 1.1.2                   | 7.2.x           | 3.0.0             |\n\n**Disclaimer** Only the scalatest 3.0.0 versions are available for Scala 2.12. Feel free to open an issue if you need Scalatest 2.2.x with 2.12.x.\n\nTo include this in your project, add the dependency (substituting version # as necessary):\n\n```sbt\nlibraryDependencies += \"org.typelevel\" %% \"scalaz-scalatest\" % \"1.1.1\" % \"test\"\n```\n\n## What does this provide?\n\nMatchers \u0026 Helpers are presently offered for testing of the following scalaz concepts:\n* Disjunction - aka `\\/` \n* `Validation`\n* `Task`\n\n## Usage\n\nThere are two ways to use the provided matchers:\n\nYou can mix them in:\n\n```scala\nclass MySillyWalkSpec extends FlatSpec with Matchers with DisjunctionMatchers { \n  // ...\n} \n```\nThis makes the matchers in `DisjunctionMatchers` available inside the scope of your test. \n\n\nYou can also import explicitly from a provided object:\n\n```scala\nimport org.typelevel.scalatest.DisjunctionMatchers\n\nclass MySillyWalkSpec extends FlatSpec with Matchers { \n  import DisjunctionMatchers._\n  // ...\n}\n\n```\n\nAlso brings the matchers into scope.\n\nAnd now, the matchers themselves.\n\n## Disjunction Matchers\n\nDisjunctionMatchers supplies the following methods:\n\n```\nbeLeft[E](element: E)\nleft[E]\nbeRight[T](element: T)\nright[T]\n```\n\n### Specific Element Matchers\n\nThe matchers that begin with a be prefix are for matching a specific element inside of the `\\/`.\n\nSomething like the following:\n\n```\nval s = \"Hello World\"\nval valueInRight = \\/.right(s)\n\n//This passes\nvalueInRight should beRight(s)\n\n//This fails with the following message:\n//\\/-(Hello World) did not contain an \\/- element matching 'goodbye'.\nvalueInRight should beRight(\"goodbye\")\n```\n\nThe matchers work the same for `beLeft`.\n\n### Right and Left Matchers\n\nThe `left` and `right` matchers are for checking to see if the `\\/` is a right or left without caring what's inside.\n\n```\n  //This passes\n  \\/.left(\"uh oh\") should be(left)\n  \n  //This fails with the following message:\n  //-\\/(uh oh) was not an \\/-, but should have been.\n  \\/.left(\"uh oh\") should be(right)\n```\n\n## Validation Matchers\n\nscalaz.Validation also has matchers similar to the ones described above.\n\n```\ndef beFailure[E](element: E)\ndef failure[E]\ndef success[T]\ndef beSuccess[T](element: T)\n```\n\nI won't repeat how they're used here. `Validation` does have an additional matcher though which allows\nyou to describe values that are in the `Failure` if you're using `ValidationNel`.\n\nThis matcher is `haveFailure` and can be used like this:\n\n```\nval validationNelValue: ValidationNel[String, Int] = Validation.failure(NonEmptyList(\"error1\", \"error2\"))\n\n//The following works fine:\nvalidationNelValue should haveFailure(\"error1\")\n\n//But you can also combine them with the and word to match multiple values:\nvalidateNelValue should (haveFailure(\"error1\") and haveFailure(\"error2\"))\n```\n\n\n## Values Helpers\n\nA very common test idiom is to want to assert the `\\/` is a left or a right and then extract the value. For this\nwe supply `DisjunctionValues`. This can be mixed into your test or imported as an object just like the matchers above, but \ninstead of providing Matchers it instead adds `value` and `leftValue` as syntax to the `\\/` type.\n\n```\nval x = \\/.right(\"hello\")\n//Passes!\nx.value shouldBe \"hello\" \n\n//Fails with the following message:\n//    'Hello' is \\/-, expected -\\/.\nx.leftValue shouldBe \"hello\" \n```\n\nThe same is true for the `Validation`. If you import or mixin `ValidationValues` you'll be able to call `.value` to extract\n`Success` and `.leftValue` to extract the `Failure` side.\n\nA similar thing is provided for `scalaz.concurrent.Task`. If you import or mixin `TaskValues` you can call `.runValue` (Scalaz 7.1) or `.syncValue` (Scalaz 7.2) to run the `Task` to completion and extract the value. You can also call `failValue` to run the `Task` to completion and extract the failure. \n## Documentation and Support\n* See the [scaladoc](https://javadoc-badge.appspot.com/org.typelevel/scalaz-scalatest_2.11).\n* The [tests](https://github.com/typelevel/scalaz-scalatest/tree/master/src/test/scala) show usage.\n* Yell at [@coltfred](https://twitter.com/coltfred) on twitter or drop by #scalaz on freenode.\n\n\n## Contributors\n\n* [Brendan McAdams](http://github.com/bwmcadams) [bwmcadams]\n* [Colt Frederickson](http://github.com/coltfred) [coltfred]\n* [Gavin Bisesi](http://github.com/Daenyth) [Daenyth]\n* [Thomas Lockney](http://github.com/tlockney) [tlockney]\n* [Ryan Delucchi](http://github.com/ryanonsrc) [ryanonsrc]\n* [Jason Swartz](http://github.com/swartzrock) [swartzrock]\n* [Murph Murphy](http://github.com/skeet70) [skeet70]\n\n\nPartially inspired by scalaz-specs2. Predecesor to [cats-scalatest](https://github.com/IronCoreLabs/cats-scalatest).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftypelevel%2Fscalaz-scalatest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftypelevel%2Fscalaz-scalatest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftypelevel%2Fscalaz-scalatest/lists"}