power_assert
Version, currently 0.2.04 versions
- 0.2.3latestApr 7, 2016
- 0.2.2not indexedJun 26, 2016
- 0.2.1not indexedJun 26, 2016
- 0.2.0not indexedJun 26, 2016
github.com/rosylilly/power_assert.cr
PowerAssert provides the more powerful assertion to you.
Nothing has been indexed for 0.2.0 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.
Installation
# Add this to your shard.yml
dependencies:
power_assert:
github: rosylilly/power_assert.cr
version: ~> 0.2.0Then run:
shards installshard.yml
No shard.yml has been indexed for 0.2.0. You can read it on the repository.
Dependencies
Unknown: the shard.yml for this version has not been read yet.
README
This README is the one indexed from the repository at its latest ref, not from the tag for this version.
power_assert.cr
PowerAssert provides the more powerful assertion to you.
Usage
Very simple.
# spec/my_lib_spec.cr
describe MyLib do
describe ".major_version" do
it "should be equal 1" do
assert MyLib.major_version == 1
end
end
end
If MyLib.major_version is 2:
F
Failures:
1) MyLib .major_version should be equal 1
Failure/Error: assert MyLib.major_version == 1
MyLib.major_version == 1
| | |
| | 1
| false
2
# ./spec/my_lib_spec.cr:6
more examples in spec.
:tada: Happy testing! :tada:
Configure
global_indent : Int: A indent size of assertion messages.sort_by : Symbol: Sort order of breakdowns. allowed::default,:reverse,:leftand:right.expand_block : Bool: Show block's codes in the breakdown.
Example Outputs
Run crystal spec.
FFFFFF
Failures:
1) PowerAssert Simple operators should be fail
Failure/Error: assert 1 == 2
1 == 2
| | |
| false
| |
| 2
1
# ./spec/power_assert_spec.cr:23
2) PowerAssert Simple operators should be fail
Failure/Error: assert 1 > 2
1 > 2
| | |
| false
| |
| 2
1
# ./spec/power_assert_spec.cr:27
3) PowerAssert Method call should be fail
Failure/Error: assert falsey == true
falsey == true
| | |
| false
| |
| true
false
# ./spec/power_assert_spec.cr:33
4) PowerAssert Method call should be fail
Failure/Error: assert example.falsey(one, two, three)
example.falsey(one, two, three)
| | | | |
| false | | |
| 1 | |
| 2 |
| 3
#<PowerAssert::Example:0x1087a6ee0>
# ./spec/power_assert_spec.cr:42
5) PowerAssert Method call should be fail
Failure/Error: assert example.one == 2
example.one == 2
| | | |
| | false
| | |
| | 2
| 1
#<PowerAssert::Example:0x1087a6e60>
# ./spec/power_assert_spec.cr:48
6) PowerAssert Method call should be fail
Failure/Error: assert array.any? { |n| n == 0 }.nil?
array.any? { ... }.nil?
| | |
| | false
| false
[1, 2, 3]
# ./spec/power_assert_spec.cr:54
Finished in 2.16 milliseconds
6 examples, 6 failures, 0 errors, 0 pending
Failed examples:
crystal spec ./spec/power_assert_spec.cr:22 # PowerAssert Simple operators should be fail
crystal spec ./spec/power_assert_spec.cr:26 # PowerAssert Simple operators should be fail
crystal spec ./spec/power_assert_spec.cr:32 # PowerAssert Method call should be fail
crystal spec ./spec/power_assert_spec.cr:36 # PowerAssert Method call should be fail
crystal spec ./spec/power_assert_spec.cr:45 # PowerAssert Method call should be fail
crystal spec ./spec/power_assert_spec.cr:51 # PowerAssert Method call should be fail
Program terminated abnormally with error code: 256
ToDo
- [ ] Support
a == b && c == d
License
Distributed under the MIT License. Please see LICENSE for details
Credits
- Sho Kusano @rosylilly for the Crystal implementation
- Takuto Wada @twada for the original JavaScript implementation. power_assert.cr is inspired by power-assert.
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.2.0- Tagged
- Jun 26, 2016
- Commit
5f5b591a44bc- Indexed
- not yet
Dependents
Repository
github.com/rosylilly/power_assert.cr
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 12, 2026
- Synced
- Aug 12, 2026
- Versions
- 4