I had been using the npm
package solidity-coverage
and while reading the coverage reports I came up with this E
symbol. I am not sure what it means and there is no explanation in the documentation as well. Does anyone know what this means?
-
Revised the answer several times, so best if you read it as of now... – goodvibration May 1 '19 at 14:07
A require(cond, msg)
statement is technically a "shortcut" for:
if (cond)
/* do some stuff */;
else
revert(msg);
Hence an E
in the solidity-coverage report means that although the if
case has been covered, the else
case has not been covered.
In your specific case, the function has been executed only with to != address(0)
.
In order to cover the other case, you'll need to execute it with to = address(0)
, for example:
try {
await func("0x0");
throw null;
}
catch (error) {
assert(error, "Expected an error but did not get one");
assert(error.message.startsWith("revert"), "Expected an error starting with 'revert' but got '" + error.message + "' instead");
}