{"id":16742563,"url":"https://github.com/johnsundell/assert","last_synced_at":"2025-03-21T22:31:36.509Z","repository":{"id":72297467,"uuid":"82589490","full_name":"JohnSundell/Assert","owner":"JohnSundell","description":"A collection of convenient assertions for Swift testing","archived":false,"fork":false,"pushed_at":"2017-11-05T22:30:32.000Z","size":52,"stargazers_count":68,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-18T05:34:58.756Z","etag":null,"topics":["assert","assertions","swift","test","testing","testing-tools","xcode"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JohnSundell.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2017-02-20T18:31:57.000Z","updated_at":"2024-12-10T20:58:54.000Z","dependencies_parsed_at":"2023-09-03T19:37:23.184Z","dependency_job_id":null,"html_url":"https://github.com/JohnSundell/Assert","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohnSundell%2FAssert","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohnSundell%2FAssert/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohnSundell%2FAssert/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohnSundell%2FAssert/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JohnSundell","download_url":"https://codeload.github.com/JohnSundell/Assert/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244880247,"owners_count":20525505,"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":["assert","assertions","swift","test","testing","testing-tools","xcode"],"created_at":"2024-10-13T01:24:10.900Z","updated_at":"2025-03-21T22:31:36.503Z","avatar_url":"https://github.com/JohnSundell.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg src=\"logo.png\" width=\"300\" max-width=\"50%\" alt=\"Assert\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://swift.org/package-manager\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/spm-compatible-brightgreen.svg?style=flat\" alt=\"Swift Package Manager\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://twitter.com/johnsundell\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/contact-@johnsundell-blue.svg?style=flat\" alt=\"Twitter: @johnsundell\" /\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\nThis repo contains a collection of assertion functions that you can use in your tests, as a complement to the assertions provided by `XCTest`, or other testing frameworks. This collection will likely grow over time, and you are more than welcome to contribute your own custom assertion functions as a pull request! :rocket:\n\n## What's in the box?\n\nHere is what you can currently assert using the functions that `Assert` provides:\n\n#### That an expression threw a given error:\n\n```swift\nassert(try myFunction(), throwsError: MyError.anError)\n```\n\n#### That a closure threw a given error:\n\n```swift\nassertErrorThrown(MyError.anError) {\n    try myFunction()\n}\n```\n\n#### That a closure didn't throw an error:\n\n```swift\nassertNoErrorThrown {\n    try myFunction()\n}\n```\n\n#### That two objects are the same instance:\n\n```swift\nassertSameInstance(objectA, objectB)\n```\n\n## Usage\n\n#### Swift Package Manager\n\nAdd the following `dependency` to your `Package.swift` file:\n\n```swift\n.package(url: \"https://github.com/johnsundell/assert\", from: \"1.0.0\")\n```\n\nThen, you can import `Assert` in your tests, like this:\n\n```swift\nimport Assert\n```\n\n#### Manually\n\nYou can also simply clone the repo, and drag the file `Sources/Assert.swift` into your Xcode project and add it to your test target.\n\n## Contributing\n\nTo work on `Assert` in Xcode, first generate an Xcode project through the Swift Package Manager:\n\n```\n$ swift package generate-xcodeproj\n```\n\nThen, make your changes to `Assert.swift`, and submit a pull request with your changes.\n\n## Questions or feedback?\n\nFeel free to [open an issue](https://github.com/JohnSundell/Assert/issues/new), or find me [@johnsundell on Twitter](https://twitter.com/johnsundell).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnsundell%2Fassert","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnsundell%2Fassert","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnsundell%2Fassert/lists"}