@@ -16,7 +16,10 @@ describe('asserts and requires', () => {
1616 beforeEach ( ( ) => coverage = new Coverage ( ) ) ;
1717 after ( async ( ) => await api . finish ( ) ) ;
1818
19- it ( 'should cover assert statements as `if` statements when they pass' , async function ( ) {
19+ // Assert was covered as a branch up to v0.7.11. But since those
20+ // conditions are never meant to be fullfilled (and assert is really for smt)
21+ // people disliked this...
22+ it ( 'should *not* cover assert statements as branches (pass)' , async function ( ) {
2023 const contract = await util . bootstrapCoverage ( 'assert/Assert' , api ) ;
2124 coverage . addContract ( contract . instrumented , util . filePath ) ;
2225 await contract . instance . a ( true ) ;
@@ -25,9 +28,7 @@ describe('asserts and requires', () => {
2528 assert . deepEqual ( mapping [ util . filePath ] . l , {
2629 5 : 1 ,
2730 } ) ;
28- assert . deepEqual ( mapping [ util . filePath ] . b , {
29- 1 : [ 1 , 0 ] ,
30- } ) ;
31+ assert . deepEqual ( mapping [ util . filePath ] . b , { } ) ;
3132 assert . deepEqual ( mapping [ util . filePath ] . s , {
3233 1 : 1 ,
3334 } ) ;
@@ -36,9 +37,9 @@ describe('asserts and requires', () => {
3637 } ) ;
3738 } ) ;
3839
39- // NB: Truffle replays failing txs as .calls to obtain the revert reason from the return
40+ // NB: truffle/contract replays failing txs as .calls to obtain the revert reason from the return
4041 // data. Hence the 2X measurements.
41- it ( 'should cover assert statements as `if` statements when they fail' , async function ( ) {
42+ it ( 'should *not* cover assert statements as branches ( fail) ' , async function ( ) {
4243 const contract = await util . bootstrapCoverage ( 'assert/Assert' , api ) ;
4344 coverage . addContract ( contract . instrumented , util . filePath ) ;
4445
@@ -48,9 +49,7 @@ describe('asserts and requires', () => {
4849 assert . deepEqual ( mapping [ util . filePath ] . l , {
4950 5 : 2 ,
5051 } ) ;
51- assert . deepEqual ( mapping [ util . filePath ] . b , {
52- 1 : [ 0 , 2 ] ,
53- } ) ;
52+ assert . deepEqual ( mapping [ util . filePath ] . b , { } ) ;
5453 assert . deepEqual ( mapping [ util . filePath ] . s , {
5554 1 : 2 ,
5655 } ) ;
0 commit comments