Commit Graph

4 Commits

Author SHA1 Message Date
Samuel Susla 582738bdc8 Use EXPECT instead of ASSERT in tests
Summary:
Changelog: [Internal]

1. Replace ASSERT_* with EXPECT_*. Assert is a fatal assertion. Expect is non-fatal assertion. So if assert fails, tests do not continue and therefore provide less information.

2. Rename tests in `RawPropsTest.cpp` from `ShadowNodeTest` to `RawPropsTest`.

Source: https://github.com/google/googletest/blob/master/googletest/docs/primer.md#basic-assertions

Reviewed By: shergin

Differential Revision: D19464967

fbshipit-source-id: add83751ebdb0a12fbf8f70b851747aa5624366a
2020-01-20 01:11:50 -08:00
Joshua Gross 1cab7ad1d6 Core: Fix props parsing when accessing prop more than once in Props struct initialization
Summary:
See previous diff implementing failing unit test in RawPropsTest.cpp.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D18664014

fbshipit-source-id: ef827bce8c676666b2ce4d5db4abbb0ab11cc454
2019-11-27 12:55:46 -08:00
Joshua Gross fb9cddcab0 Core: Fix infinite loop in prop parsing
Summary:
See previous diff where I added RawPropsTest.cpp to unit-test this functionality. Before this, if you looked up a prop name that does not exist, the prop parser would enter an infinite loop.

I also took this opportunity to comment the block a little bit as it's not super intuitive at first glance.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D18662135

fbshipit-source-id: 319a3b80d1c606db18b2added9f2aa99d4d03407
2019-11-27 12:55:46 -08:00
Joshua Gross 46ca564fbf RawPropsTest C++ unit tests (fabric)
Summary:
Add RawPropsTests unit tests.

The general idea is to cover the normal props use-cases and then add a few abnormal cases and some errors, to make sure nothing crashes.

The final test uncovers an infinite loop in RawProp parsing.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D18662136

fbshipit-source-id: 2f603b4c3e32f2d4334587e898ea81ad025b07b6
2019-11-27 12:55:45 -08:00