You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2023/01/07 23:50:14 UTC

[couchdb-rebar] branch eunit-cover created (now e938b3d)

This is an automated email from the ASF dual-hosted git repository.

jaydoane pushed a change to branch eunit-cover
in repository https://gitbox.apache.org/repos/asf/couchdb-rebar.git


      at e938b3d  Relax ANNO limitation in test coverage utils

This branch includes the following new commits:

     new e938b3d  Relax ANNO limitation in test coverage utils

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[couchdb-rebar] 01/01: Relax ANNO limitation in test coverage utils

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jaydoane pushed a commit to branch eunit-cover
in repository https://gitbox.apache.org/repos/asf/couchdb-rebar.git

commit e938b3d724183d81e22b964ecc34da9f884669ce
Author: Jay Doane <ja...@apache.org>
AuthorDate: Sat Jan 7 15:49:59 2023 -0800

    Relax ANNO limitation in test coverage utils
    
    Currently the code to determine whether a particular file attribute
    ("header") exists assumes an ANNO format of a single line number, but
    versions of OTP > 23 return a tuple, so that pattern will never match,
    resulting in coverage failing to account for the inclusion of the
    `eunit.hrl` file, and then incorrectly calculating the coverage of the
    test module as 66%, rather than the expected 100%.
    
    This change relaxes the pattern so that it will also match tuples,
    and fixes the eunit coverage test.
    
    See also: https://github.com/apache/couchdb-rebar/pull/5
---
 src/rebar_cover_utils.erl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/rebar_cover_utils.erl b/src/rebar_cover_utils.erl
index 7b85f1c..cb50c0c 100644
--- a/src/rebar_cover_utils.erl
+++ b/src/rebar_cover_utils.erl
@@ -184,7 +184,7 @@ has_header(Mod, Header) ->
            end,
     {ok, {_, [{abstract_code, {_, AC}}]}} =
         beam_lib:chunks(Mod1, [abstract_code]),
-    [F || {attribute, 1, file, {F, 1}} <- AC,
+    [F || {attribute, _, file, {F, 1}} <- AC,
           string:str(F, Header) =/= 0] =/= [].
 
 align_notcovered_count(Module, Covered, NotCovered, false) ->