You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.5 KiB
37 lines
1.5 KiB
7 years ago
|
/* eslint-env node, mocha */
|
||
|
|
||
|
const path = require('path');
|
||
|
const getInstrumentedVersion = require('./../lib/instrumentSolidity.js');
|
||
|
const util = require('./util/util.js');
|
||
|
const solc = require('solc');
|
||
|
|
||
|
describe('comments', () => {
|
||
|
const filePath = path.resolve('./test.sol');
|
||
|
const pathPrefix = './';
|
||
|
|
||
|
it('should cover functions even if comments are present immediately after the opening {', () => {
|
||
|
const contract = util.getCode('comments/postFunctionDeclarationComment.sol');
|
||
|
const info = getInstrumentedVersion(contract, filePath);
|
||
|
const output = solc.compile(info.contract, 1);
|
||
|
util.report(output.errors);
|
||
|
});
|
||
|
it('should cover lines even if comments are present', () => {
|
||
|
const contract = util.getCode('comments/postLineComment.sol');
|
||
|
const info = getInstrumentedVersion(contract, filePath);
|
||
|
const output = solc.compile(info.contract, 1);
|
||
|
util.report(output.errors);
|
||
|
});
|
||
|
it('should cover contracts even if comments are present', () => {
|
||
|
const contract = util.getCode('comments/postContractComment.sol');
|
||
|
const info = getInstrumentedVersion(contract, filePath);
|
||
|
const output = solc.compile(info.contract, 1);
|
||
|
util.report(output.errors);
|
||
|
});
|
||
|
it('should cover if statements even if comments are present immediately after opening { ', () => {
|
||
|
const contract = util.getCode('comments/postIfStatementComment.sol');
|
||
|
const info = getInstrumentedVersion(contract, filePath);
|
||
|
const output = solc.compile(info.contract, 1);
|
||
|
util.report(output.errors);
|
||
|
});
|
||
|
});
|