From e3b2818581bceba4585eaa670816ea2faa97ca17 Mon Sep 17 00:00:00 2001 From: Eli White Date: Thu, 7 Mar 2019 18:17:07 -0800 Subject: [PATCH] Add test for -0.0 float Summary: This was an idea to check by Joshua Gross Changelog: [General][Internal] Codegen: Adding test for negative zero floats Reviewed By: JoshuaGross Differential Revision: D14378418 fbshipit-source-id: 4d18eea18143c501d3f2e7ba334f35ec1dd140e6 --- .../src/generators/__test_fixtures__/fixtures.js | 8 ++++++++ .../__tests__/__snapshots__/GeneratePropsCpp-test.js.snap | 3 ++- .../__tests__/__snapshots__/GeneratePropsH-test.js.snap | 1 + .../__snapshots__/GenerateViewConfigJs-test.js.snap | 1 + 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/react-native-codegen/src/generators/__test_fixtures__/fixtures.js b/packages/react-native-codegen/src/generators/__test_fixtures__/fixtures.js index bfbfa7ab23228f..bf3c0269ad8b79 100644 --- a/packages/react-native-codegen/src/generators/__test_fixtures__/fixtures.js +++ b/packages/react-native-codegen/src/generators/__test_fixtures__/fixtures.js @@ -213,6 +213,14 @@ const FLOAT_PROPS: SchemaType = { default: 1, }, }, + { + name: 'blurRadius6', + optional: true, + typeAnnotation: { + type: 'FloatTypeAnnotation', + default: -0.0, + }, + }, ], }, }, diff --git a/packages/react-native-codegen/src/generators/__tests__/__snapshots__/GeneratePropsCpp-test.js.snap b/packages/react-native-codegen/src/generators/__tests__/__snapshots__/GeneratePropsCpp-test.js.snap index dfd4d724ba6feb..e3e6ec4719c53e 100644 --- a/packages/react-native-codegen/src/generators/__tests__/__snapshots__/GeneratePropsCpp-test.js.snap +++ b/packages/react-native-codegen/src/generators/__tests__/__snapshots__/GeneratePropsCpp-test.js.snap @@ -169,7 +169,8 @@ FloatPropNativeComponentProps::FloatPropNativeComponentProps( blurRadius2(convertRawProp(rawProps, \\"blurRadius2\\", sourceProps.blurRadius2, blurRadius2)), blurRadius3(convertRawProp(rawProps, \\"blurRadius3\\", sourceProps.blurRadius3, blurRadius3)), blurRadius4(convertRawProp(rawProps, \\"blurRadius4\\", sourceProps.blurRadius4, blurRadius4)), -blurRadius5(convertRawProp(rawProps, \\"blurRadius5\\", sourceProps.blurRadius5, blurRadius5)) +blurRadius5(convertRawProp(rawProps, \\"blurRadius5\\", sourceProps.blurRadius5, blurRadius5)), +blurRadius6(convertRawProp(rawProps, \\"blurRadius6\\", sourceProps.blurRadius6, blurRadius6)) {} } // namespace react diff --git a/packages/react-native-codegen/src/generators/__tests__/__snapshots__/GeneratePropsH-test.js.snap b/packages/react-native-codegen/src/generators/__tests__/__snapshots__/GeneratePropsH-test.js.snap index f2a0f78497522c..77d351181c34f4 100644 --- a/packages/react-native-codegen/src/generators/__tests__/__snapshots__/GeneratePropsH-test.js.snap +++ b/packages/react-native-codegen/src/generators/__tests__/__snapshots__/GeneratePropsH-test.js.snap @@ -207,6 +207,7 @@ const Float blurRadius2{0.001}; const Float blurRadius3{2.1}; const Float blurRadius4{0.0}; const Float blurRadius5{1.0}; +const Float blurRadius6{0.0}; }; } // namespace react diff --git a/packages/react-native-codegen/src/generators/__tests__/__snapshots__/GenerateViewConfigJs-test.js.snap b/packages/react-native-codegen/src/generators/__tests__/__snapshots__/GenerateViewConfigJs-test.js.snap index 0358579cda539c..16fca4bf0c171f 100644 --- a/packages/react-native-codegen/src/generators/__tests__/__snapshots__/GenerateViewConfigJs-test.js.snap +++ b/packages/react-native-codegen/src/generators/__tests__/__snapshots__/GenerateViewConfigJs-test.js.snap @@ -226,6 +226,7 @@ const FloatPropNativeComponentViewConfig = { blurRadius3: true, blurRadius4: true, blurRadius5: true, + blurRadius6: true, style: ReactNativeStyleAttributes } };