On Thu, Nov 10, 2016 at 10:00 AM, Mike Hommey <m...@glandium.org> wrote:

>
> CppUnitTests are fine to keep.


Having said that, IMO it is desirable to convert CppUnitTests to gtests
where possible. Every CppUnitTest has to provide some basic check/pass/fail
infrastructure, and many of them provide their own. Converting to gtest
provides consistency and usually ends up making tests shorter. E.g. a lot
of code like this:

  if (!Foo(bar)) {
    printf("Foo failed");
    return false;
  }

becomes this:

  ASSERT_TRUE(Foo(bar)) << "Foo failed";

The tests in mfbt/tests/ are good candidates for conversion, if anyone is
in the mood. There is some good gtest documentation here:

https://github.com/google/googletest/blob/master/googletest/docs/Primer.md
https://github.com/google/googletest/blob/master/googletest/docs/AdvancedGuide.md

But the absolute basics (tests go in a 'TEST' block, use ASSERT_* for fatal
failures and EXPECT_* for non-fatal failures) cover most cases.

Nick
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to