Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,52 @@ Use following test frameworks or extensions instead.
== Reference
* {Power Assert in Ruby (at RubyKaigi 2014) // Speaker Deck}[https://speakerdeck.com/k_tsj/power-assert-in-ruby]

== Known Limitations
* Expressions must be put in one line. Expressions with folded long lines produce nothing report, e.g.:
assert do
Copy link
Member

@k-tsj k-tsj Aug 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A block passed to assert method should contain only one expression, because power_assert just shows first one of expressions.
So it is better to write examples as follows.

assert do
  # reported
  func(foo: 0123456789, bar: "abcdefg")
end

assert do
  # won't be reported
  func(foo: 0123456789,
       bar: "abcdefg")
end

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I've split them.

# reported
func(foo: 0123456789, bar: "abcdefg")
end

assert do
# won't be reported
func(foo: 0123456789,
bar: "abcdefg")
end
* Expressions must have one or more method call. Expressions with no method call produce nothing report, e.g.:
val = false
assert do
# reported
val == true
end

assert do
# won't be reported
val
end
* Returned values from accessor methods, method missing, or "super" produce nothing report, e.g:
class Foo
attr_accessor :val
end
foo = Foo.new
foo.val = false

assert do
# reported (only the value of "foo" and the literal "true")
foo.val == true
end

assert do
# won't be reported
foo.val
end
* Expressions should not have conditional branches. Expressions with such conditional codes may produce nothing report, e.g.:
condition = true
expected = false
actual = true
assert do
# this will fail but nothing reported
condition ? expected == actual : expected == actual
end

== Travis Build Status {<img src="https://secure.travis-ci.org/k-tsj/power_assert.png?branch=master"/>}[http://travis-ci.org/k-tsj/power_assert]