Skip to content

Commit aa017e5

Browse files
authored
Merge pull request #4587 from wilzbach/test-codecov
show code coverage with Codecov.io
2 parents 1f6f02a + 11b4c1f commit aa017e5

File tree

2 files changed

+26
-14
lines changed

2 files changed

+26
-14
lines changed

.travis.yml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,35 @@ sudo: false
22
os: linux
33
language: d
44
d: dmd-2.071.0
5+
git:
6+
depth: 1
57
install:
6-
- wget "https://raw.githubusercontent.com/dlang/dmd/master/src/checkwhitespace.d" -O ../checkwhitespace.d
8+
- mkdir phobos
9+
- ls -1 | grep -v ^phobos | xargs -I{} mv {} phobos
10+
- git clone --depth=1 https://github.com/dlang/dmd
11+
- git clone --depth=1 https://github.com/dlang/druntime
12+
# whitespace check
13+
- wget "https://raw.githubusercontent.com/dlang/dmd/master/src/checkwhitespace.d" -O checkwhitespace.d
14+
# dscanner
715
- git clone https://github.com/Hackerpilot/Dscanner
816
- (cd Dscanner && git checkout tags/v0.4.0-alpha6)
917
- (cd Dscanner && git submodule update --init --recursive)
1018
# debug build is faster, but disable 'missing import' messages (missing core from druntime)
1119
- (cd Dscanner && sed 's/dparse_verbose/StdLoggerDisableWarning/' -i makefile && make githash debug)
1220
# avoid checking it's dscanner's directory
13-
- mv Dscanner/dsc .
14-
- rm -rf Dscanner
1521
script:
16-
- (cd .. && rdmd ./checkwhitespace.d $(find phobos -name '*.d'))
22+
- rdmd ./checkwhitespace.d $(find phobos -name '*.d')
1723
# enforce whitespace between statements
18-
- grep -nE "(for|foreach|foreach_reverse|if|while|switch|catch)\(" $(find . -name '*.d'); test $? -eq 1
24+
- (cd phobos && grep -nE "(for|foreach|foreach_reverse|if|while|switch|catch)\(" $(find . -name '*.d'); test $? -eq 1)
1925
# enforce whitespace between colon(:) for import statements (doesn't catch everything)
20-
- grep -n 'import [^/,=]*:.*;' $(find . -name '*.d') | grep -vE "import ([^ ]+) :\s"; test $? -eq 1
26+
- (cd phobos && grep -n 'import [^/,=]*:.*;' $(find . -name '*.d') | grep -vE "import ([^ ]+) :\s"; test $? -eq 1)
2127
# enforce all-man style
22-
- grep -nE '(if|for|foreach|foreach_reverse|while|unittest|switch|else|version) .*{$' $(find . -name '*.d'); test $? -eq 1
28+
- (cd phobos && grep -nE '(if|for|foreach|foreach_reverse|while|unittest|switch|else|version) .*{$' $(find . -name '*.d'); test $? -eq 1)
2329
# at the moment libdparse has problems to parse some modules (->excludes)
24-
- ./dsc --config .dscanner.ini --styleCheck $(find etc std -type f -name '*.d' | grep -vE 'std/traits.d|std/typecons.d|std/conv.d') -I.
30+
- (cd phobos && ../Dscanner/dsc --config ../.dscanner.ini --styleCheck $(find etc std -type f -name '*.d' | grep -vE 'std/traits.d|std/typecons.d|std/conv.d') -I.)
31+
# test code coverage
32+
- (cd dmd && make -f posix.mak)
33+
- (cd druntime && make -f posix.mak)
34+
- (cd phobos && make -f posix.mak $(find std etc -name "*.d" | sed "s/[.]d$/.test/" | grep -vE '(std.algorithm.sorting|std.encoding|net.curl)' ))
35+
after_success:
36+
- (cd phobos && bash <(curl -s https://codecov.io/bash))

std/numeric.d

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1934,10 +1934,10 @@ result is greater than or equal to $(D max).
19341934
ElementType!Range entropy(Range)(Range r) if (isInputRange!Range)
19351935
{
19361936
Unqual!(typeof(return)) result = 0.0;
1937-
foreach (e; r)
1937+
for (;!r.empty; r.popFront)
19381938
{
1939-
if (!e) continue;
1940-
result -= e * log2(e);
1939+
if (!r.front) continue;
1940+
result -= r.front * log2(r.front);
19411941
}
19421942
return result;
19431943
}
@@ -1948,10 +1948,10 @@ if (isInputRange!Range &&
19481948
!is(CommonType!(ElementType!Range, F) == void))
19491949
{
19501950
Unqual!(typeof(return)) result = 0.0;
1951-
foreach (e; r)
1951+
for (;!r.empty; r.popFront)
19521952
{
1953-
if (!e) continue;
1954-
result -= e * log2(e);
1953+
if (!r.front) continue;
1954+
result -= r.front * log2(r.front);
19551955
if (result >= max) break;
19561956
}
19571957
return result;

0 commit comments

Comments
 (0)