better tests
authorAlexander Solovyov <piranha@piranha.org.ua>
Sat, 27 Jun 2009 20:52:15 +0300
changeset 19 70838ce7b26a
parent 18 04881fa9e4f3
child 20 a1423afc1160
better tests
test.py
--- a/test.py	Sat Jun 27 20:52:03 2009 +0300
+++ b/test.py	Sat Jun 27 20:52:15 2009 +0300
@@ -17,21 +17,26 @@
 
     Let's try to do that (damn, but what?!)
     '''
+    if opts.get('pass'):
+        return
     # test ui
     ui.write('what the?!\n')
     ui.warn('this is stderr\n')
     ui.status('this would be invisible in quiet mode\n')
     ui.note('this would be visible only in verbose mode\n')
     ui.write('%s, %s\n' % (args, opts))
+    if opts.get('exit'):
+        sys.exit(opts['exit'])
 
 cmdtable = {
-    'simple':
+    '^simple':
         (simple,
          [('t', 'test', False, 'just test execution')],
          '[-t] ...'),
-    'complex':
+    'complex|hard':
         (complex_,
-         [],
+         [('p', 'pass', False, 'don\'t run the command'),
+          ('', 'exit', 0, 'exit with supplied code (default: 0)')],
          '')}
 
 if __name__ == '__main__':