Add generation script header to generated tests
Summary: Add header to generated code so that code can easily be re-generated in case test generation is improved in the future. Reviewed By: lucasr Differential Revision: D3715181 fbshipit-source-id: 593baa691c2d7c7f171c6673898fb8a2ecf0e008
This commit is contained in:
committed by
Facebook Github Bot 6
parent
c373056d80
commit
28bc42a988
@@ -8,10 +8,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
window.onload = function() {
|
window.onload = function() {
|
||||||
printTest(calculateTree(document.body.children[0]));
|
printTest(document.body.children[0], calculateTree(document.body.children[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
function printTest(layoutTree) {
|
function printTest(rootNode, layoutTree) {
|
||||||
var lines = [
|
var lines = [
|
||||||
'/**',
|
'/**',
|
||||||
' * Copyright (c) 2014-present, Facebook, Inc.',
|
' * Copyright (c) 2014-present, Facebook, Inc.',
|
||||||
@@ -22,11 +22,32 @@ function printTest(layoutTree) {
|
|||||||
' * of patent rights can be found in the PATENTS file in the same directory.',
|
' * of patent rights can be found in the PATENTS file in the same directory.',
|
||||||
' */',
|
' */',
|
||||||
'',
|
'',
|
||||||
|
];
|
||||||
|
|
||||||
|
lines.push('/**');
|
||||||
|
lines.push(' * @Generated by gentest/gentest.sh with the following input');
|
||||||
|
lines.push(' *');
|
||||||
|
lines.push(rootNode.innerHTML.split('\n').map(function(line) {
|
||||||
|
return line.trim();
|
||||||
|
}).filter(function(line) {
|
||||||
|
return line.length > 0 && line !== '<div id="default"></div>';
|
||||||
|
}).map(function(line) {
|
||||||
|
return ' * ' + line;
|
||||||
|
}).reduce(function(curr, prev) {
|
||||||
|
return curr + '\n' + prev;
|
||||||
|
}));
|
||||||
|
lines.push(' *');
|
||||||
|
lines.push(' */');
|
||||||
|
lines.push('');
|
||||||
|
|
||||||
|
lines.push([
|
||||||
'#include <CSSLayout/CSSLayout-internal.h>',
|
'#include <CSSLayout/CSSLayout-internal.h>',
|
||||||
'#include <CSSLayoutTestUtils/CSSLayoutTestUtils.h>',
|
'#include <CSSLayoutTestUtils/CSSLayoutTestUtils.h>',
|
||||||
'#include <gtest/gtest.h>',
|
'#include <gtest/gtest.h>',
|
||||||
'',
|
'',
|
||||||
];
|
].reduce(function(curr, prev) {
|
||||||
|
return curr + '\n' + prev;
|
||||||
|
}));
|
||||||
|
|
||||||
for (var i = 0; i < layoutTree.length - 1; i++) {
|
for (var i = 0; i < layoutTree.length - 1; i++) {
|
||||||
lines.push('TEST(CSSLayoutTest, INSERT_NAME_HERE) {');
|
lines.push('TEST(CSSLayoutTest, INSERT_NAME_HERE) {');
|
||||||
|
@@ -7,6 +7,16 @@
|
|||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Generated by gentest/gentest.sh with the following input
|
||||||
|
*
|
||||||
|
* <div style="width: 300px; height: 100px; flex-direction: row;">
|
||||||
|
* <div style="flex-basis: 100px; flex-grow: 1;"></div>
|
||||||
|
* <div style="flex-grow: 1;"></div>
|
||||||
|
* </div>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#include <CSSLayout/CSSLayout-internal.h>
|
#include <CSSLayout/CSSLayout-internal.h>
|
||||||
#include <CSSLayoutTestUtils/CSSLayoutTestUtils.h>
|
#include <CSSLayoutTestUtils/CSSLayoutTestUtils.h>
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
Reference in New Issue
Block a user