Make generated test input more copy pastable

Summary: previously when copying in a test inout into an editor the user of gentest needed to remove the ` * ` prefix. This was annoying so this diff fixes that by removing that from gentest.

Reviewed By: lucasr

Differential Revision: D3862943

fbshipit-source-id: 06bd3ee3fa3f85cc44b6ea1d67cf3e91ed368791
This commit is contained in:
Emil Sjolander
2016-09-14 08:51:05 -07:00
committed by Facebook Github Bot 0
parent 64fffcb8f3
commit 8fcb265830
13 changed files with 311 additions and 294 deletions

View File

@@ -36,17 +36,17 @@ function printTest(rootNode, layoutTree) {
}).map(function(line) {
var result;
if (line.indexOf('</div') == 0) {
result = ' * ' + ' '.repeat(indentation - 1) + line;
result = ' '.repeat(indentation - 1) + line;
} else {
result = ' * ' + ' '.repeat(indentation) + line;
result = ' '.repeat(indentation) + line;
}
indentation += (line.match(/<div/g) || []).length;
indentation -= (line.match(/<\/div/g) || []).length;
return result;
}).reduce(function(curr, prev) {
if (prev.indexOf(' * <div') == 0) {
prev = ' * \n' + prev;
if (prev.indexOf('<div') == 0) {
prev = '\n' + prev;
}
return curr + '\n' + prev;
}));