1
0
Fork 0

Smarten example generator

This commit is contained in:
Willi Goesgens 2015-08-06 17:52:36 +02:00
parent 9d4eb0d54a
commit a05e0fb246
1 changed files with 18 additions and 2 deletions

View File

@ -157,6 +157,7 @@ var XXX;
var testFunc; var testFunc;
var countErrors; var countErrors;
var collectionAlreadyThere = []; var collectionAlreadyThere = [];
var ignoreCollectionAlreadyThere = [];
internal.startPrettyPrint(true); internal.startPrettyPrint(true);
internal.stopColorPrint(true); internal.stopColorPrint(true);
var appender = function(text) { var appender = function(text) {
@ -286,19 +287,34 @@ var checkForOrphanTestCollections = function(msg) {
}; };
var addIgnoreCollection = function(collectionName) { var addIgnoreCollection = function(collectionName) {
print("from now on ignoring this collection whether its dropped: " + collectionName); // print("from now on ignoring this collection whether its dropped: " + collectionName);
collectionAlreadyThere.push(collectionName); collectionAlreadyThere.push(collectionName);
ignoreCollectionAlreadyThere.push(collectionName);
}; };
var removeIgnoreCollection = function(collectionName) { var removeIgnoreCollection = function(collectionName) {
print("from now on checking again whether this collection dropped: " + collectionName); // print("from now on checking again whether this collection dropped: " + collectionName);
for (j=0; j < collectionAlreadyThere.length; j++) { for (j=0; j < collectionAlreadyThere.length; j++) {
if (collectionAlreadyThere[j] === collectionName) { if (collectionAlreadyThere[j] === collectionName) {
collectionAlreadyThere[j] = undefined; collectionAlreadyThere[j] = undefined;
} }
} }
for (j=0; j < ignoreCollectionAlreadyThere.length; j++) {
if (ignoreCollectionAlreadyThere[j] === collectionName) {
ignoreCollectionAlreadyThere[j] = undefined;
}
}
}; };
var checkIgnoreCollectionAlreadyThere = function () {
if (ignoreCollectionAlreadyThere.length > 0) {
allErrors += "some temporarily ignored collections haven't been cleaned up: " +
ignoreCollectionAlreadyThere;
}
}
// Set the first available list of already there collections: // Set the first available list of already there collections:
var err = allErrors; var err = allErrors;
checkForOrphanTestCollections('Collections already there which we will ignore from now on:'); checkForOrphanTestCollections('Collections already there which we will ignore from now on:');