Updated german (de) translation (Guido Schimmels).
[rox-lib.git] / tests / python / testrox.py
blob47b19da8c7a9a8a1410dfe037b76b77d55646e6a
1 #!/usr/bin/env python2.2
2 import unittest
3 import os, sys, shutil
4 from StringIO import StringIO
5 sys.path.append('../../python')
7 if os.environ.has_key('ROXLIB_TEST_SUB'):
8 import rox
9 for arg in sys.argv[1:]:
10 print arg
11 sys.exit()
12 os.environ['ROXLIB_TEST_SUB'] = 'YES'
14 from rox import processes
16 class TestROX(unittest.TestCase):
17 def try_with_args(self, args):
18 result = StringIO()
19 ptc = processes.PipeThroughCommand(
20 ['./testrox.py'] + args, None, result)
21 ptc.wait()
22 return result.getvalue()
24 def testEmpty(self):
25 self.assertEquals('', self.try_with_args([]))
27 def testStdin(self):
28 self.assertEquals('-\n', self.try_with_args(['-']))
30 def testNormal(self):
31 self.assertEquals('hello\nworld\n',
32 self.try_with_args(['hello', 'world']))
34 def testNormal(self):
35 self.assertEquals('world\n-\n',
36 self.try_with_args(['--g-fatal-warnings',
37 'world', '-']))
39 suite = unittest.makeSuite(TestROX)
40 if __name__ == '__main__':
41 sys.argv.append('-v')
42 unittest.main()