From 1be3e86cc11efb18a0006911f974289ba95f2a64 Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Thu, 4 Oct 2012 15:55:57 +0200
Subject: [PATCH] Add unit test for FilterEmptyLinesAndComments

I somehow forgot this in the previous patch.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>
---
 test/ganeti.utils.text_unittest.py | 36 ++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/test/ganeti.utils.text_unittest.py b/test/ganeti.utils.text_unittest.py
index f80ecb36b..e1181821f 100755
--- a/test/ganeti.utils.text_unittest.py
+++ b/test/ganeti.utils.text_unittest.py
@@ -593,5 +593,41 @@ class TestTruncate(unittest.TestCase):
       self.assertRaises(AssertionError, utils.Truncate, "", i)
 
 
+class TestFilterEmptyLinesAndComments(unittest.TestCase):
+  @staticmethod
+  def _Test(text):
+    return list(utils.FilterEmptyLinesAndComments(text))
+
+  def testEmpty(self):
+    self.assertEqual(self._Test(""), [])
+    self.assertEqual(self._Test("\n"), [])
+    self.assertEqual(self._Test("\n" * 100), [])
+    self.assertEqual(self._Test("\n  \n\t \n"), [])
+
+  def test(self):
+    text = """
+      This
+        is
+      # with comments
+          a
+            test
+            # in
+            #
+            saying
+      ...#...
+        # multiple places
+        Hello World!
+      """
+    self.assertEqual(self._Test(text), [
+      "This",
+      "is",
+      "a",
+      "test",
+      "saying",
+      "...#...",
+      "Hello World!",
+      ])
+
+
 if __name__ == "__main__":
   testutils.GanetiTestProgram()
-- 
GitLab