{"id":41913515,"url":"https://github.com/xybor-x/xycond","last_synced_at":"2026-01-25T16:15:54.603Z","repository":{"id":58350902,"uuid":"531354921","full_name":"xybor-x/xycond","owner":"xybor-x","description":"A package supports to assert or expect many conditions in Golang","archived":false,"fork":false,"pushed_at":"2022-10-10T15:46:44.000Z","size":28,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"dev","last_synced_at":"2024-09-23T06:07:26.679Z","etag":null,"topics":["assert","assertion","conditions","golang-library","testing","unittest"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"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/xybor-x.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2022-09-01T03:54:57.000Z","updated_at":"2022-10-13T12:28:47.000Z","dependencies_parsed_at":"2023-01-19T19:45:54.633Z","dependency_job_id":null,"html_url":"https://github.com/xybor-x/xycond","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/xybor-x/xycond","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xybor-x%2Fxycond","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xybor-x%2Fxycond/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xybor-x%2Fxycond/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xybor-x%2Fxycond/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xybor-x","download_url":"https://codeload.github.com/xybor-x/xycond/tar.gz/refs/heads/dev","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xybor-x%2Fxycond/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28755125,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-25T13:59:49.818Z","status":"ssl_error","status_checked_at":"2026-01-25T13:59:33.728Z","response_time":113,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["assert","assertion","conditions","golang-library","testing","unittest"],"created_at":"2026-01-25T16:15:54.537Z","updated_at":"2026-01-25T16:15:54.598Z","avatar_url":"https://github.com/xybor-x.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Xybor founder](https://img.shields.io/badge/xybor-huykingsofm-red)](https://github.com/huykingsofm)\n[![Go Reference](https://pkg.go.dev/badge/github.com/xybor-x/xycond.svg)](https://pkg.go.dev/github.com/xybor-x/xycond)\n[![GitHub Repo stars](https://img.shields.io/github/stars/xybor-x/xycond?color=yellow)](https://github.com/xybor-x/xycond)\n[![GitHub top language](https://img.shields.io/github/languages/top/xybor-x/xycond?color=lightblue)](https://go.dev/)\n[![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/xybor-x/xycond)](https://go.dev/blog/go1.18)\n[![GitHub release (release name instead of tag name)](https://img.shields.io/github/v/release/xybor-x/xycond?include_prereleases)](https://github.com/xybor-x/xycond/releases/latest)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/a8c3269dd8654796a09a898406997e96)](https://www.codacy.com/gh/xybor-x/xycond/dashboard?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=xyplatform/xyerror\u0026utm_campaign=Badge_Grade)\n[![Codacy Badge](https://app.codacy.com/project/badge/Coverage/a8c3269dd8654796a09a898406997e96)](https://www.codacy.com/gh/xybor-x/xycond/dashboard?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=xyplatform/xyerror\u0026utm_campaign=Badge_Coverage)\n[![Go Report](https://goreportcard.com/badge/github.com/xybor-x/xycond)](https://goreportcard.com/report/github.com/xybor-x/xycond)\n\n# Introduction\n\nPackage xycond supports to assert or expect many conditions.\n\nIt makes source code to be shorter and more readable by using inline commands.\n\n# Features\n\nThis package has the following features:\n\n-   Assert a condition, panic in case condition is false.\n-   Expect a condition to occur and perform actions on this expectation.\n-   Panic with an assertion error.\n\n# Benchmark\n\n## ExpectIn\n\n| op                  | time per op |\n| ------------------- | ----------: |\n| large-map           |       293ns |\n| small-map           |       209ns |\n| large-array         |    196507ns |\n| small-array         |       375ns |\n| large-string-string |    115002ns |\n| small-string-string |       455ns |\n| large-string-rune   |       194ns |\n| small-string-rune   |       192ns |\n\n# Example\n\n1.  Assert conditions\n\n```golang\nxycond.AssertFalse(1 == 2)\n\nvar x int\nxycond.AssertZero(x)\n\nxycond.ExpectFalse(true).Assert(\"this is a custom assertion message\")\n```\n\n2.  Testing\n\n```golang\n// Test a condition with *testing.T or *testing.B.\nfunc TestSomething(t *testing.T) {\n    xycond.ExpectEmpty(\"\").Test(t)\n}\n```\n\n3.  Perform actions on expectation\n\n```golang\n// Perform actions on an expectation.\nxycond.ExpectEqual(1, 2).\n    True(func() {\n        fmt.Printf(\"1 == 2\")\n    }).\n    False(func() {\n        fmt.Printf(\"1 != 2\")\n    })\n\n// Output:\n// 1 != 2\n```\n\n4.  Panic with formatted string\n\n```golang\nfunc foo() {\n    xycond.Panicf(\"foo %s\", \"bar\")\n}\n\nfunc bar() int {\n    return xycond.Panic(\"buzzz\").(int)\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxybor-x%2Fxycond","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxybor-x%2Fxycond","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxybor-x%2Fxycond/lists"}