Skip to content

Commit

Permalink
Fix misc-misplaced-const warnings in Yoga tests (#1677)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #1677

We have Clang Tidy warnings enabled internally, that will flag `const YG*Ref` as misleading, as a const pointer to non-const, instead of non-const pointer to const.

Let's remove all the misleading const in existing tests, and generated tests.

Reviewed By: joevilches

Differential Revision: D59335968

fbshipit-source-id: c66af878904ba7900f8ffcd99162968d90f8e5c7
  • Loading branch information
NickGerleman authored and facebook-github-bot committed Jul 4, 2024
1 parent e4fe14a commit 5009f5c
Show file tree
Hide file tree
Showing 44 changed files with 2,785 additions and 2,797 deletions.
6 changes: 2 additions & 4 deletions gentest/gentest-cpp.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
this.push('');
}

this.push('const YGConfigRef config = YGConfigNew();');
this.push('YGConfigRef config = YGConfigNew();');
for (const i in experiments) {
this.push(
'YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeature' +
Expand All @@ -63,9 +63,7 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {

emitTestTreePrologue: {
value: function (nodeName) {
this.push(
'const YGNodeRef ' + nodeName + ' = YGNodeNewWithConfig(config);',
);
this.push('YGNodeRef ' + nodeName + ' = YGNodeNewWithConfig(config);');
},
},

Expand Down
12 changes: 6 additions & 6 deletions tests/FlexGapTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,26 @@
// TODO: move this to a fixture based test once it supports parsing negative
// values
TEST(FlexGap, gap_negative_value) {
const YGConfigRef config = YGConfigNew();
YGConfigRef config = YGConfigNew();

const YGNodeRef root = YGNodeNewWithConfig(config);
YGNodeRef root = YGNodeNewWithConfig(config);
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetGap(root, YGGutterAll, -20);
YGNodeStyleSetHeight(root, 200);

const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
YGNodeRef root_child0 = YGNodeNewWithConfig(config);
YGNodeStyleSetWidth(root_child0, 20);
YGNodeInsertChild(root, root_child0, 0);

const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
YGNodeRef root_child1 = YGNodeNewWithConfig(config);
YGNodeStyleSetWidth(root_child1, 20);
YGNodeInsertChild(root, root_child1, 1);

const YGNodeRef root_child2 = YGNodeNewWithConfig(config);
YGNodeRef root_child2 = YGNodeNewWithConfig(config);
YGNodeStyleSetWidth(root_child2, 20);
YGNodeInsertChild(root, root_child2, 2);

const YGNodeRef root_child3 = YGNodeNewWithConfig(config);
YGNodeRef root_child3 = YGNodeNewWithConfig(config);
YGNodeStyleSetWidth(root_child3, 20);
YGNodeInsertChild(root, root_child3, 3);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
Expand Down
Loading

0 comments on commit 5009f5c

Please sign in to comment.