From f6e90bb0c95c479679bd040019a5c45e47bbf666 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Thu, 18 Jan 2018 00:02:06 +0100 Subject: [PATCH 1/2] Switch to codecov.io. --- .codecov.yml | 14 ++++++++++++++ README.md | 3 ++- travis.sh | 4 ++-- 3 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 .codecov.yml diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 0000000..e2ed4ad --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,14 @@ +# Documentation: https://docs.codecov.io/docs/codecov-yaml + +coverage: + precision: 3 + round: down + range: "80...100" + + status: + # Learn more at https://docs.codecov.io/docs/commit-status + project: true + patch: true + changes: true + +comment: false diff --git a/README.md b/README.md index 4a08480..9d360ab 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,8 @@ TaggedAlgebraic Implementation of a generic algebraic data type with a tagged union storage. All operations of the contained types are available for the `TaggedAlgebraic` -[![Build Status](https://travis-ci.org/s-ludwig/taggedalgebraic.svg?branch=master)](https://travis-ci.org/s-ludwig/taggedalgebraic) [![Coverage Status](https://coveralls.io/repos/s-ludwig/taggedalgebraic/badge.png?branch=master)](https://coveralls.io/r/s-ludwig/taggedalgebraic?branch=master) +[![Build Status](https://travis-ci.org/s-ludwig/taggedalgebraic.svg?branch=master)](https://travis-ci.org/s-ludwig/taggedalgebraic) [![codecov](https://codecov.io/gh/s-ludwig/taggedalgebraic/branch/master/graph/badge.svg)](https://codecov.io/gh/s-ludwig/taggedalgebraic) + Usage ----- diff --git a/travis.sh b/travis.sh index aa88675..b90fa1c 100755 --- a/travis.sh +++ b/travis.sh @@ -3,9 +3,9 @@ set -ueo pipefail if [ ! -z "${COVERAGE:-}" ]; then - dub fetch doveralls dub test -b unittest-cov - dub run doveralls + wget https://codecov.io/bash -O codecov.sh + bash codecov.sh else dub test fi From f9c7d444e6eed36ccee13a554b6eb671d6993f25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Thu, 18 Jan 2018 00:06:06 +0100 Subject: [PATCH 2/2] Disable TypeOf on frontent versions < 2.072.x --- source/taggedalgebraic.d | 45 ++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/source/taggedalgebraic.d b/source/taggedalgebraic.d index 200c7fe..75c0197 100644 --- a/source/taggedalgebraic.d +++ b/source/taggedalgebraic.d @@ -658,34 +658,35 @@ unittest { } -/** Maps a kind enumeration value to the corresponding field type. +static if (__VERSION__ >= 2072) { + /** Maps a kind enumeration value to the corresponding field type. - `kind` must be a value of the `TaggedAlgebraic!T.Kind` enumeration. -*/ -template TypeOf(alias kind) - if (isInstanceOf!(TypeEnum, typeof(kind))) -{ - import std.traits : FieldTypeTuple, TemplateArgsOf; - alias U = TemplateArgsOf!(typeof(kind)); - alias TypeOf = FieldTypeTuple!U[kind]; -} - -/// -unittest { - static struct S { - int a; - string b; - string c; + `kind` must be a value of the `TaggedAlgebraic!T.Kind` enumeration. + */ + template TypeOf(alias kind) + if (isInstanceOf!(TypeEnum, typeof(kind))) + { + import std.traits : FieldTypeTuple, TemplateArgsOf; + alias U = TemplateArgsOf!(typeof(kind)); + alias TypeOf = FieldTypeTuple!U[kind]; } - alias TA = TaggedAlgebraic!S; - static assert(is(TypeOf!(TA.Kind.a) == int)); - static assert(is(TypeOf!(TA.Kind.b) == string)); - static assert(is(TypeOf!(TA.Kind.c) == string)); + /// + unittest { + static struct S { + int a; + string b; + string c; + } + alias TA = TaggedAlgebraic!S; + + static assert(is(TypeOf!(TA.Kind.a) == int)); + static assert(is(TypeOf!(TA.Kind.b) == string)); + static assert(is(TypeOf!(TA.Kind.c) == string)); + } } - /** Gets the value stored in an algebraic type based on its data type. */ ref inout(T) get(T, U)(ref inout(TaggedAlgebraic!U) ta)