From 8cb809048541c6dc06224bb17e705cfbe76527d1 Mon Sep 17 00:00:00 2001 From: Tom Jackson Date: Wed, 1 Apr 2015 15:22:31 -0700 Subject: [PATCH] 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 --- folly/gen/ParallelMap-inl.h | 2 +- folly/gen/test/FileTest.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/folly/gen/ParallelMap-inl.h b/folly/gen/ParallelMap-inl.h index 0bdadc37..08ca3f55 100644 --- a/folly/gen/ParallelMap-inl.h +++ b/folly/gen/ParallelMap-inl.h @@ -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 PMap : public Operator> { diff --git a/folly/gen/test/FileTest.cpp b/folly/gen/test/FileTest.cpp index 38b907fd..ad70326c 100644 --- a/folly/gen/test/FileTest.cpp +++ b/folly/gen/test/FileTest.cpp @@ -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(v, '\n'); }; + + auto squares = seq(1, 100) | map([](int x) { return x * x; }); + squares | map(toLine) | eachAs() | toFile(File(file.fd())); + EXPECT_EQ(squares | sum, + byLine(File(file.path().c_str())) | eachTo() | sum); +} + INSTANTIATE_TEST_CASE_P( DifferentBufferSizes, FileGenBufferedTest, -- 2.34.1