1
0
Fork 0

Doc - Docublock example generation (#4791)

This commit is contained in:
Manuel B 2018-03-09 12:51:27 +01:00 committed by sleto-it
parent ef6ccafec4
commit c79f719ea4
1 changed files with 23 additions and 16 deletions

View File

@ -506,18 +506,21 @@ def generateAQL(testName):
if not AQLBV in value: if not AQLBV in value:
value[AQLBV] = "{}" value[AQLBV] = "{}"
if not AQLDS in value:
value[AQLDS] = ""
print ''' print '''
%s %s
/// %s /// %s
(function() { (() => {
internal.startPrettyPrint(true); internal.startPrettyPrint(true);
internal.stopColorPrint(true); internal.stopColorPrint(true);
var testName = '%s'; const testName = '%s';
var lineCount = 0; const lineCount = 0;
var startLineCount = %d; const startLineCount = %d;
var outputDir = '%s'; const outputDir = '%s';
var sourceFile = '%s'; const sourceFile = '%s';
var startTime = time(); const startTime = time();
output = ''; output = '';
''' % ( ''' % (
('/'*80), ('/'*80),
@ -527,13 +530,15 @@ def generateAQL(testName):
escapeBS.sub(doubleBS, OutputDir), escapeBS.sub(doubleBS, OutputDir),
escapeBS.sub(doubleBS, MapSourceFiles[testName]) escapeBS.sub(doubleBS, MapSourceFiles[testName])
) )
print " let query = `" + value[AQL] + "`;" print " const query = `" + value[AQL] + "`;"
print " let bv = " + value[AQLBV] + ";" print " const bv = " + value[AQLBV] + ";"
print " let ds = '" + value[AQLDS] + "';" print " const ds = '" + value[AQLDS] + "';"
print ''' print '''
exds.%s.removeDS(); if (ds !== '') {
exds.%s.createDS(); exds[ds].removeDS();
let result = db._query(query, bv).toArray(); exds[ds].createDS();
}
const result = db._query(query, bv).toArray();
output += "@Q:\\n" output += "@Q:\\n"
output += highlight("js", query); output += highlight("js", query);
@ -544,13 +549,15 @@ def generateAQL(testName):
output += "\\n@R\\n"; output += "\\n@R\\n";
jsonAppender(JSON.stringify(result, null, 2)); jsonAppender(JSON.stringify(result, null, 2));
exds.%s.removeDS(); if (ds !== '') {
exds[ds].removeDS();
}
fs.write(outputDir + fs.pathSeparator + testName + '.generated', output); fs.write(outputDir + fs.pathSeparator + testName + '.generated', output);
print("[" + (time () - startTime) + "s] done with " + testName); print("[" + (time () - startTime) + "s] done with " + testName);
checkForOrphanTestCollections('not all collections were cleaned up after ' + sourceFile + ' Line[' + startLineCount + '] [' + testName + ']:'); checkForOrphanTestCollections('not all collections were cleaned up after ' + sourceFile + ' Line[' + startLineCount + '] [' + testName + ']:');
}()); })();
''' % (value[AQLDS], value[AQLDS], value[AQLDS]) '''
################################################################################ ################################################################################
### @brief generate arangosh run ### @brief generate arangosh run