README.md in linepipe-0.1.2 vs README.md in linepipe-0.2.0
- old
+ new
@@ -24,11 +24,12 @@
Linepipe's DSL consists of 4 different parts:
* `setup`: Optional setup that will be run at the beginning.
* `data`: The input data.
* `step`: As many of these as you want will conform the steps of your
- algorithm.
+ algorithm. You can optionally provide an `expect` block that will test the
+ output right after than particular step.
* `expect`: In development mode, each of these will be run against your final
output data to ensure its conformity with your expectations.
While developing a processing algorithm, `Linepipe.develop` is your friend. Each
`process` block will be reduced against your data in order, and then each
@@ -40,16 +41,20 @@
%w(foo bar baz)
}
step("Upcasing") { |data|
data.map(&:upcase)
- }
+ }.expect('is upcased') { |data|
+ data.first == 'FOO'
+ } # as you see, each step can have its own expectations that will be tested
+ # when the data leaves that particular step of the pipeline
step("Reversing") { |data|
data.reverse
}
+ # now the final expectation on the result
expect { |data|
data == %w(BAZ BAR FOO)
}
end
@@ -86,14 +91,14 @@
linepipe = Linepipe.benchmark(10_000) do
data {
%w(foo bar baz)
}
- process("Upcasing") { |data|
+ step("Upcasing") { |data|
data.map(&:upcase)
}
- process("Reversing") { |data|
+ step("Reversing") { |data|
data.reverse
}
expect { |data|
data == %w(BAZ BAR FOO)