Add experiment support to gentest
Summary: This diff does two things - Clean up some of the generated code making the files smaller. - Add experiment support to generated tests allowing us to use gentest for things still being experimented with such as more compliant flex-basis behavior. Reviewed By: gkassabli Differential Revision: D4226734 fbshipit-source-id: 2cc1471c21883e8e326f16e7a8bb1a3657acd84b
This commit is contained in:
committed by
Facebook Github Bot
parent
a0d560a24b
commit
22b0fdb3e6
@@ -26,20 +26,35 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
]);
|
||||
}},
|
||||
|
||||
emitTestPrologue:{value:function(name) {
|
||||
emitTestPrologue:{value:function(name, experiments) {
|
||||
this.push('TEST(CSSLayoutTest, ' + name + ') {');
|
||||
this.pushIndent();
|
||||
|
||||
if (experiments.length > 0) {
|
||||
for (var i in experiments) {
|
||||
this.push('CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeature' + experiments[i] +', true);');
|
||||
}
|
||||
this.push('');
|
||||
}
|
||||
}},
|
||||
|
||||
emitTestTreePrologue:{value:function(nodeName) {
|
||||
this.push('const CSSNodeRef ' + nodeName + ' = CSSNodeNew();');
|
||||
}},
|
||||
|
||||
emitTestEpilogue:{value:function() {
|
||||
emitTestEpilogue:{value:function(experiments) {
|
||||
this.push([
|
||||
'',
|
||||
'CSSNodeFreeRecursive(root);',
|
||||
]);
|
||||
|
||||
if (experiments.length > 0) {
|
||||
this.push('');
|
||||
for (var i in experiments) {
|
||||
this.push('CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeature' + experiments[i] +', false);');
|
||||
}
|
||||
}
|
||||
|
||||
this.popIndent();
|
||||
this.push([
|
||||
'}',
|
||||
@@ -130,7 +145,7 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
}},
|
||||
|
||||
CSSNodeStyleSetBorder:{value:function(nodeName, edge, value) {
|
||||
this.push('CSSNodeStyleSetBorder(' + nodeName + ', ' + edge + ', ' + value + ');');
|
||||
this.push('CSSNodeStyleSetBorder(' + nodeName + ', ' + edge + ', ' + toFloatString(value) + ');');
|
||||
}},
|
||||
|
||||
CSSNodeStyleSetDirection:{value:function(nodeName, value) {
|
||||
|
Reference in New Issue
Block a user