From 7aeb6b4f246a09c8033178cfca359e0e6a05da36 Mon Sep 17 00:00:00 2001 From: Devon Estes Date: Tue, 9 Jan 2018 14:55:12 +0100 Subject: [PATCH 1/3] Add additional documentation for `assert_in_delta` and `refute_in_delta` In a previous commit I changed the behavior of `assert_in_delta`, but I forgot to document that change so it's clear to users in the future. I also made it clear that `refute_in_delta` is exclusive, so folks shouldn't have questions about that anymore. --- lib/ex_unit/lib/ex_unit/assertions.ex | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/ex_unit/lib/ex_unit/assertions.ex b/lib/ex_unit/lib/ex_unit/assertions.ex index bdcf4b6c917..bca3759544c 100644 --- a/lib/ex_unit/lib/ex_unit/assertions.ex +++ b/lib/ex_unit/lib/ex_unit/assertions.ex @@ -668,13 +668,15 @@ defmodule ExUnit.Assertions do end @doc """ - Asserts that `value1` and `value2` differ by no more than `delta`. + Asserts that `value1` and `value2` differ by no more than `delta`. This difference is + inclusive, so the test will pass if the difference and the `delta` are equal. ## Examples assert_in_delta 1.1, 1.5, 0.2 - assert_in_delta 10, 15, 4 + assert_in_delta 10, 15, 2 + assert_in_delta 10, 15, 5 """ def assert_in_delta(value1, value2, delta, message \\ nil) @@ -838,7 +840,8 @@ defmodule ExUnit.Assertions do end @doc """ - Asserts `value1` and `value2` are not within `delta`. + Asserts `value1` and `value2` are not within `delta`. This difference is exclusive, + so the test will fail if the difference and the delta are equal. If you supply `message`, information about the values will automatically be appended to it. From bcb008cd9e14a1a7295fa824631365a5af74ebfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 9 Jan 2018 15:06:45 +0100 Subject: [PATCH 2/3] Keep first line of docs short --- lib/ex_unit/lib/ex_unit/assertions.ex | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/ex_unit/lib/ex_unit/assertions.ex b/lib/ex_unit/lib/ex_unit/assertions.ex index bca3759544c..da8e1842166 100644 --- a/lib/ex_unit/lib/ex_unit/assertions.ex +++ b/lib/ex_unit/lib/ex_unit/assertions.ex @@ -668,9 +668,10 @@ defmodule ExUnit.Assertions do end @doc """ - Asserts that `value1` and `value2` differ by no more than `delta`. This difference is - inclusive, so the test will pass if the difference and the `delta` are equal. - + Asserts that `value1` and `value2` differ by no more than `delta`. + + This difference is inclusive, so the test will pass if the difference + and the `delta` are equal. ## Examples @@ -840,8 +841,10 @@ defmodule ExUnit.Assertions do end @doc """ - Asserts `value1` and `value2` are not within `delta`. This difference is exclusive, - so the test will fail if the difference and the delta are equal. + Asserts `value1` and `value2` are not within `delta`. + + This difference is exclusive, so the test will fail if the difference + and the delta are equal. If you supply `message`, information about the values will automatically be appended to it. From 6074271c6a63559cbe2c8ff446c23680a82e43e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 9 Jan 2018 15:07:24 +0100 Subject: [PATCH 3/3] Remove trailing whitespace --- lib/ex_unit/lib/ex_unit/assertions.ex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ex_unit/lib/ex_unit/assertions.ex b/lib/ex_unit/lib/ex_unit/assertions.ex index da8e1842166..1c2ef3cfd52 100644 --- a/lib/ex_unit/lib/ex_unit/assertions.ex +++ b/lib/ex_unit/lib/ex_unit/assertions.ex @@ -669,7 +669,7 @@ defmodule ExUnit.Assertions do @doc """ Asserts that `value1` and `value2` differ by no more than `delta`. - + This difference is inclusive, so the test will pass if the difference and the `delta` are equal. @@ -842,7 +842,7 @@ defmodule ExUnit.Assertions do @doc """ Asserts `value1` and `value2` are not within `delta`. - + This difference is exclusive, so the test will fail if the difference and the delta are equal.