diff --git a/gentest/gentest.js b/gentest/gentest.js index 198dcbb2..18199b95 100755 --- a/gentest/gentest.js +++ b/gentest/gentest.js @@ -8,10 +8,10 @@ */ 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 = [ '/**', ' * 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.', ' */', '', + ]; + + 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 !== '
'; + }).map(function(line) { + return ' * ' + line; + }).reduce(function(curr, prev) { + return curr + '\n' + prev; + })); + lines.push(' *'); + lines.push(' */'); + lines.push(''); + + lines.push([ '#include