From 02835800f5199c11549eadc23493d699cf2a5830 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sat, 21 Aug 2021 20:46:12 -0500 Subject: [PATCH 1/2] fix: update sumtype --- dub.json | 2 +- dub.selections.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dub.json b/dub.json index b95ccb0..6be6d3f 100644 --- a/dub.json +++ b/dub.json @@ -4,7 +4,7 @@ "Paul Backus" ], "dependencies": { - "sumtype": ">=0.6.2 <1.0.0" + "sumtype": "1.1.4" }, "description": "Error handling that bundles exceptions with return values", "copyright": "Copyright © 2018, Paul Backus", diff --git a/dub.selections.json b/dub.selections.json index f6c7453..7cd6b1e 100644 --- a/dub.selections.json +++ b/dub.selections.json @@ -1,6 +1,6 @@ { "fileVersion": 1, "versions": { - "sumtype": "0.8.4" + "sumtype": "1.1.4" } } From 8689f805e26b7c42ee657ad106f97174fbb3cbeb Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sat, 21 Aug 2021 20:52:36 -0500 Subject: [PATCH 2/2] fix: approxEqual deprecation --- src/expectations.d | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/expectations.d b/src/expectations.d index 9a74e1a..e141f3f 100644 --- a/src/expectations.d +++ b/src/expectations.d @@ -439,7 +439,7 @@ template map(alias fun) } @safe unittest { - import std.math: approxEqual; + import std.math: isClose; Expected!int x = 123; Expected!int y = new Exception("oops"); @@ -450,12 +450,12 @@ template map(alias fun) x.map!half; })); - assert(x.map!half.value.approxEqual(61.5)); + assert(x.map!half.value.isClose(61.5)); assert(y.map!half.error.msg == "oops"); alias mapHalf = map!half; - assert(mapHalf(Expected!int(123)).value.approxEqual(61.5)); + assert(mapHalf(Expected!int(123)).value.isClose(61.5)); } @safe unittest { @@ -502,7 +502,7 @@ template flatMap(alias fun) } @safe unittest { - import std.math: approxEqual; + import std.math: isClose; Expected!int x = 123; Expected!int y = 0; @@ -521,17 +521,17 @@ template flatMap(alias fun) x.flatMap!recip; })); - assert(x.flatMap!recip.value.approxEqual(1.0/123)); + assert(x.flatMap!recip.value.isClose(1.0/123)); assert(y.flatMap!recip.error.msg == "Division by zero"); assert(z.flatMap!recip.error.msg == "oops"); alias flatMapRecip = flatMap!recip; - assert(flatMapRecip(Expected!int(123)).value.approxEqual(1.0/123)); + assert(flatMapRecip(Expected!int(123)).value.isClose(1.0/123)); } @safe unittest { - import std.math: approxEqual; + import std.math: isClose; Expected!(int, string) x = 123; Expected!(int, string) y = 0; @@ -550,7 +550,7 @@ template flatMap(alias fun) x.flatMap!recip; })); - assert(x.flatMap!recip.value.approxEqual(1.0/123)); + assert(x.flatMap!recip.value.isClose(1.0/123)); assert(y.flatMap!recip.error == "Division by zero"); assert(z.flatMap!recip.error == "oops"); }