stripLeftMargin
authorYedidya Feldblum <yfeldblum@fb.com>
Wed, 10 Feb 2016 00:28:21 +0000 (16:28 -0800)
committerfacebook-github-bot-0 <folly-bot@fb.com>
Wed, 10 Feb 2016 01:20:27 +0000 (17:20 -0800)
commitb0a7bdf6b2ad6255b4ea843703b77aed040718d3
tree111a57d4600475f05e3b29774d03f7c3c3168879
parent5e5cf95a1602ea0edafbc2f04a9ae03ec611007f
stripLeftMargin

Summary:
[Folly] `stripLeftMargin`.

So you can do:

    TEST(MyClass, doSomethingWithString) {
      //  Multiline string literal is indented properly inside the test case
      //  instead of being aligned all the way to the left, which would make
      //  the test case read poorly.
      auto input = folly::stripLeftMargin(R"TEXT(
        first line
        second line
        third line
      )TEXT");
      auto expected = //...
      auto actual = MyClass::doSomethingWithString(input);
      EXPECT_EQ(expected, actual);
    }

Reviewed By: markisaa

Differential Revision: D2909736

fb-gh-sync-id: ebb07da05e1a788535064cfcd9e07f617a007800
shipit-source-id: ebb07da05e1a788535064cfcd9e07f617a007800
folly/String.cpp
folly/String.h
folly/test/StringTest.cpp