Revision f2b91949 test/py/ganeti.utils.text_unittest.py

b/test/py/ganeti.utils.text_unittest.py
445 445
      b = ["a", "b" + sep + "c", "d" + sep + "e" + sep + "f", "g"]
446 446
      self.failUnlessEqual(utils.UnescapeAndSplit(sep.join(a), sep=sep), b)
447 447

  
448
class TestEscapeAndJoin(unittest.TestCase):
449
  def verifyParsesCorrect(self, args):
450
    for sep in [",", "+", ".", ":"]:
451
      self.assertEqual(utils.UnescapeAndSplit(
452
          utils.EscapeAndJoin(args, sep=sep),
453
          sep=sep), args)
454

  
455
  def test(self):
456
    self.verifyParsesCorrect(["a", "b", "c"])
457
    self.verifyParsesCorrect(["2.10.0", "12345"])
458
    self.verifyParsesCorrect(["2.10.0~alpha1", "12345"])
459
    self.verifyParsesCorrect(["..:", ",,+"])
460
    self.verifyParsesCorrect(["a\\", "b\\\\", "c"])
461
    self.verifyParsesCorrect(["a"])
462
    self.verifyParsesCorrect(["+"])
463
    self.verifyParsesCorrect(["\\"])
464
    self.verifyParsesCorrect(["\\\\"])
465

  
448 466

  
449 467
class TestCommaJoin(unittest.TestCase):
450 468
  def test(self):

Also available in: Unified diff