test_escape.py 427 B

123456789101112131415161718
  1. from pwman_tstlib import *
  2. initTest(__file__)
  3. from libpwman.ui import escapeCmd, unescapeCmd
  4. class Test_Escape(TestCase):
  5. def test_escape(self):
  6. t0 = t1 = '1-2x-y-a\tb c\\\\_ \\\\ x_-y\r\n_\tz\v__\\\\__\\-'
  7. nrIter = 3
  8. print("ORIG :", t0)
  9. for i in range(nrIter):
  10. t1 = escapeCmd(t1)
  11. print("ESC%d : %s" % (i, t1))
  12. for i in range(nrIter):
  13. t1 = unescapeCmd(t1)
  14. print("UNESC:", t1)
  15. self.assertEqual(t1, t0)