{"id":19713521,"url":"https://github.com/shalomb/p6-assertions","last_synced_at":"2026-06-17T09:31:40.813Z","repository":{"id":101380284,"uuid":"96365658","full_name":"shalomb/p6-Assertions","owner":"shalomb","description":"Runtime assertions for Perl 6","archived":false,"fork":false,"pushed_at":"2017-07-06T01:59:56.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-27T20:33:26.909Z","etag":null,"topics":["assertions","module","perl6","perl6-module","perl6-scripts"],"latest_commit_sha":null,"homepage":null,"language":"Perl6","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"artistic-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shalomb.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-05T22:18:33.000Z","updated_at":"2017-07-06T01:41:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"54fc488e-4d4a-4e06-a76b-e96e7e118d1b","html_url":"https://github.com/shalomb/p6-Assertions","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/shalomb/p6-Assertions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shalomb%2Fp6-Assertions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shalomb%2Fp6-Assertions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shalomb%2Fp6-Assertions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shalomb%2Fp6-Assertions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shalomb","download_url":"https://codeload.github.com/shalomb/p6-Assertions/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shalomb%2Fp6-Assertions/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34443232,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-17T02:00:05.408Z","response_time":127,"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":["assertions","module","perl6","perl6-module","perl6-scripts"],"created_at":"2024-11-11T22:23:12.125Z","updated_at":"2026-06-17T09:31:40.793Z","avatar_url":"https://github.com/shalomb.png","language":"Perl6","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NAME\n\nAssertions - Runtime assertions for Perl 6\n\n# SYNOPSIS\n\n    use Assertions\n\n    my $x = 42;\n\n    assert $x;                      # Assert $x is defined and evaluates to something truthy\n\n    assert x %% 5;                  # Assert a simple expression. `assertion failed.`\n\n    assert $x² \u003c 1729,              # Include a user-friendly error message\n          'Ramanujan was slightly off the mark';\n\n    assert { ($x+1).is-prime };     # Assert a block\n\n    assert {\n        ((1/$x¹, 1/$x², 1/$x³ … { $_ \u003c 1/($x**$x) }).elems) == $x;\n      },\n      \"No magic found with $x\";\n\n    assert { $frodo.has-ring },\n           { Logger.log('Oops, he did it again!'); }\n\n## Non-fatal assertions\n\nIn line with `assert` available in languages like C, C++, Python, etc `assert`\nthrows an exception if the test expression fails. To make assertions non-fatal\nand log failure messages to STDERR instead, use the `:non-fatal` flag.\n\n    my $x = (-20,-15 ... 30).pick;\n    assert $x.sqrt !~~ NaN, :non-fatal;       # $x might be a negative number\n    with $x { do something(); }               # control resumes here\n    … \n\nIn fact, `:non-fatal` may be needed when the test expression or block itself may\nthrow an (inadvertent) exception.\n\n    assert { die  \"See you later, I'm out …\" },  # :non-fatal handles exceptions in this block\n           { note \"But wait, I live again …\" },  # so that this block is called\n           :non-fatal\n\n# DESCRIPTION\n\n`Assertions` provides an assertion mechanism for Perl 6 in the style of \n[assert.h](http://en.wikipedia.org/wiki/Assert.h) (NOTE: Unlike `assert` from \n`assert.h`, these are subroutines and are not available at compilation time).\n\n## Note\n\nPerl6's type system, sub/method signatures and return types, exceptions, etc\nsomewhat make assertions an unneeded feature of the language and you should\ndefer to the features of the language over the use of `assert` from this module\nfor performance and stability (amongst other) reasons.\n\n# TODO\n\n* Make use of `DEBUG` and `NDEBUG` to control assertions.\n* Enable tracing to track triggered assertions.\n* Consider if Smart Comments may be of use.\n\n# SEE ALSO\n\n* [assert.h](http://en.wikipedia.org/wiki/Assert.h) - Wikipedia page on `assert.h`\n* [assertions](http://search.cpan.org/perldoc?assertions) - Assertions for Perl \u003e= 5.9.0\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshalomb%2Fp6-assertions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshalomb%2Fp6-assertions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshalomb%2Fp6-assertions/lists"}