www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16397] New: test_runner in coverage mode doesn't match with

https://issues.dlang.org/show_bug.cgi?id=16397

          Issue ID: 16397
           Summary: test_runner in coverage mode doesn't match with
                    individual test (covers less)
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: greensunny12 gmail.com


the test_runner and individual tests, see also:

https://github.com/dlang/phobos/pull/4719#issuecomment-239363404

The difference only exists in some module, but for example in std.digest.digest
different coverage hits are reported:

1) Output with test_runner (compiled with ENABLE_COVERAGE=1),

e.g. generated/linux/debug/64/unittest/test_runner std.digest.digest

       |            body
       |            {
0000000|                enum string msg = "Buffer needs to be at least " ~
digestLength!(T).stringof ~ " bytes " ~
       |                    "big, check " ~ typeof(this).stringof ~ ".length!";
0000000|                asArray!(digestLength!T)(buf, msg) = _digest.peek();
0000000|                return buf[0 .. digestLength!T];
       |            }
       |
       |             trusted ubyte[] peek() const
       |            {
0000000|                enum len = digestLength!T;
0000000|                auto buf = new ubyte[len];
0000000|                asArray!(digestLength!T)(buf) = _digest.peek();
0000000|                return buf;
       |            }
       |        }

2) make -f posix.mak std/digest/digest.test

       |            body
       |            {
      1|                enum string msg = "Buffer needs to be at least " ~
digestLength!(T).stringof ~ " bytes " ~
       |                    "big, check " ~ typeof(this).stringof ~ ".length!";
      1|                asArray!(digestLength!T)(buf, msg) = _digest.peek();
      1|                return buf[0 .. digestLength!T];
       |            }
       |
       |             trusted ubyte[] peek() const
       |            {
      1|                enum len = digestLength!T;
      1|                auto buf = new ubyte[len];
      1|                asArray!(digestLength!T)(buf) = _digest.peek();
      1|                return buf;
       |            }

--
Aug 16 2016