Commit 8cb80904 authored by Tom Jackson's avatar Tom Jackson Committed by afrind

Minor fixes from documentation

Test Plan: unittests

Reviewed By: jbrewer@fb.com, ashishsharma@fb.com

Subscribers: maxime, folly-diffs@, yfeldblum, chalfant

FB internal diff: D1956101

Signature: t1:1956101:1427828321:2d828e6f2c06c6dcd6e7baa3ed5e72ee59d9b77f
parent 06607304
......@@ -38,7 +38,7 @@ namespace folly { namespace gen { namespace detail {
*
* This type is usually used through the 'pmap' helper function:
*
* auto squares = seq(1, 10) | pmap(4, fibonacci) | sum;
* auto squares = seq(1, 10) | pmap(fibonacci, 4) | sum;
*/
template<class Predicate>
class PMap : public Operator<PMap<Predicate>> {
......
......@@ -69,6 +69,16 @@ TEST_P(FileGenBufferedTest, FileWriter) {
EXPECT_TRUE(expected == found);
}
TEST(FileGenBufferedTest, FileWriterSimple) {
test::TemporaryFile file("FileWriter");
auto toLine = [](int v) { return to<std::string>(v, '\n'); };
auto squares = seq(1, 100) | map([](int x) { return x * x; });
squares | map(toLine) | eachAs<StringPiece>() | toFile(File(file.fd()));
EXPECT_EQ(squares | sum,
byLine(File(file.path().c_str())) | eachTo<int>() | sum);
}
INSTANTIATE_TEST_CASE_P(
DifferentBufferSizes,
FileGenBufferedTest,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment