Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes 'Upgraded' as a keyword from verification tool #180

Merged
merged 1 commit into from
Aug 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions verification/README.verification.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@ Contract Block Titles:
'FiatToken_PositiveTests', 'PositiveTestsupgraded', 'PositiveTests' etc.,
but not 'upgradedPositiveTests'.)

- Should include the word 'Upgraded' if they test an upgraded version of the
FiatToken. (Note: This will skip verification on tests in the contract block.
The assumption is that any test that is run on an upgraded version of the
token is also run on a non-upgraded version of the token.)

- Should include the word 'Legacy' if they run tests that do not need to be
recorded in the spreadsheet and can be ignored by the verification tool.

Expand Down
29 changes: 11 additions & 18 deletions verification/verification_reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ function verification_reporter (runner) {
spec_reporter.call(this, runner);

var spreadsheet;
var spreadsheet_clone;
var errs = [];
var pending = {};

Expand All @@ -34,26 +35,17 @@ function verification_reporter (runner) {
spreadsheet = await sheets.load().catch((err) => {
console.log(err);
});
spreadsheet_clone = JSON.parse(JSON.stringify(spreadsheet));
});

// Runs at the beginning of each contract block execution.
runner.on('suite', function(suite) {
// If contract block title is marked 'Upgraded' or 'Legacy',
// If contract block title is marked 'Legacy',
// we skip verification. (See README.verification)
var upgraded = suite.title.match(/Upgraded/gi);
var legacy = suite.title.match(/Legacy/gi);
if (upgraded && legacy) {
if (legacy) {
console.log(indent +
'This test file is marked "Upgraded" and "Legacy". Skipping verification.');
} else {
if (upgraded) {
console.log(indent +
'This test file is marked "Upgraded". Skipping verification.');
}
if (legacy) {
console.log(indent +
'This test file is marked "Legacy". Skipping verification.');
}
'This test file is marked "Legacy". Skipping verification.');
}

// We also skip verification on the 'PausableTests' file.
Expand All @@ -68,11 +60,10 @@ function verification_reporter (runner) {

// Runs at the end of every test.
runner.on('test end', function (test) {
// If contract block title is marked 'Upgraded' or 'Legacy',
// If contract block title is marked 'Legacy',
// we skip verification. (See README.verification)
var upgraded = test.parent.title.match(/Upgraded/gi);
var legacy = test.parent.title.match(/Legacy/gi);
if (upgraded || legacy) {
if (legacy) {
return;
}

Expand Down Expand Up @@ -120,7 +111,7 @@ function verification_reporter (runner) {
} else {
// Verify test is in spreadsheet.
if (spreadsheet[file]) {
let spreadsheet_test = spreadsheet[file][id];
let spreadsheet_test = spreadsheet[file][id] || spreadsheet_clone[file][id];
if (spreadsheet_test) {
// Verify test descriptions match.
if (spreadsheet_test == test_ran) {
Expand All @@ -142,7 +133,9 @@ function verification_reporter (runner) {
+ '\n' + indent + 'Diff: ' + diff);
}
// If test is included in spreadsheet, 'cross-off' by deleting.
delete spreadsheet[file][id];
if (spreadsheet[file][id]) {
delete spreadsheet[file][id];
}
} else {
// If test is not in spreadsheet.
console.log(indent + red_x
Expand Down