aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test
diff options
context:
space:
mode:
authorBaptiste Fontaine2015-12-14 14:57:17 +0100
committerBaptiste Fontaine2015-12-14 16:34:12 +0100
commitf1ac9b5776bbd49c9ce71b4ddf138bcc61b9b8f6 (patch)
treec34058ca30ede73e397e9230103838963878860e /Library/Homebrew/test
parent9127ee1928c1de98f1f158dd4169e2e3a5a90275 (diff)
downloadbrew-f1ac9b5776bbd49c9ce71b4ddf138bcc61b9b8f6.tar.bz2
pretty_duration: fixed for int arguments
Without this the returned string is not as accurate if the method is called with an int larger than 120. Closes Homebrew/homebrew#47002. Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
Diffstat (limited to 'Library/Homebrew/test')
-rw-r--r--Library/Homebrew/test/test_utils.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/Library/Homebrew/test/test_utils.rb b/Library/Homebrew/test/test_utils.rb
index 0be6f50eb..f533e3f90 100644
--- a/Library/Homebrew/test/test_utils.rb
+++ b/Library/Homebrew/test/test_utils.rb
@@ -48,6 +48,14 @@ class UtilTests < Homebrew::TestCase
assert_predicate $?, :success?
end
+ def test_pretty_duration
+ assert_equal "2 seconds", pretty_duration(1)
+ assert_equal "2 seconds", pretty_duration(2.5)
+ assert_equal "42 seconds", pretty_duration(42)
+ assert_equal "4.2 minutes", pretty_duration(252)
+ assert_equal "4.2 minutes", pretty_duration(252.45)
+ end
+
def test_plural
assert_equal "", plural(1)
assert_equal "s", plural(0)