From c85eccbf64920f5cdcc13ec57e7a6516c02d6905 Mon Sep 17 00:00:00 2001
From: Brian Warner <warner@lothar.com>
Date: Sat, 21 Feb 2009 18:01:16 -0700
Subject: [PATCH] test_web.py: increase test coverage of web.status.plural()

---
 src/allmydata/test/test_web.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/allmydata/test/test_web.py b/src/allmydata/test/test_web.py
index e2ae8fc4..9aa5929c 100644
--- a/src/allmydata/test/test_web.py
+++ b/src/allmydata/test/test_web.py
@@ -2530,6 +2530,18 @@ class Util(unittest.TestCase):
         self.failUnlessEqual(common.abbreviate_size(1230), "1.2kB")
         self.failUnlessEqual(common.abbreviate_size(123), "123B")
 
+    def test_plural(self):
+        def convert(s):
+            return "%d second%s" % (s, status.plural(s))
+        self.failUnlessEqual(convert(0), "0 seconds")
+        self.failUnlessEqual(convert(1), "1 second")
+        self.failUnlessEqual(convert(2), "2 seconds")
+        def convert2(s):
+            return "has share%s: %s" % (status.plural(s), ",".join(s))
+        self.failUnlessEqual(convert2([]), "has shares: ")
+        self.failUnlessEqual(convert2(["1"]), "has share: 1")
+        self.failUnlessEqual(convert2(["1","2"]), "has shares: 1,2")
+
 
 class Grid(GridTestMixin, WebErrorMixin, unittest.TestCase):
 
-- 
2.45.2