hhspecify/hhassert
最新稳定版本:0.2.0
Composer 安装命令:
composer require hhspecify/hhassert
包简介
Simple assertion library for Hack
README 文档
README
hhassert is simple assertion library for Hack.
You can use easily as assert module of nodejs.
Basic Usage
It will specify the hhassert\Assert in the use keyword.
use hhassert\Assert; Assert::ok(1 === 1); //Passed Assert::ok("a" === "b"); //Failed Assert::equal("a", "a"); //Passed Assert::equal(1, 1); //Passed Assert::equal(1.0, 2.0); //Failed Assert::notEqual("a", "b"); //Passed Assert::notEqual("a", "a"); //Failed Assert::throws(() ==> { throw new InvalidArgumentException("exception!!"); }, InvalidArgumentException::class);
Custom matcher
You can be the registration of the matcher in the configure method. Matcher specified in the lambda expression.
Assert::configure((ContextBuilder $builder) ==> { $builder->registerMatcher('custom_matcher', (...) ==> { list($a, $b) = func_get_args(); if ($a !== $b) { throw new AssertionFailedException("custom matcher"); } }); }); Assert::custom_matcher("a", "b");
Run the test
composer install
composer test
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-06-25