From ac7b70118d8256e19191bfed89b3a12c34e58ded Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Thu, 1 Jan 2009 10:55:15 +0000 Subject: [PATCH] Tests for copy-src and diff commands --- tests/testcompile.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/testcompile.py b/tests/testcompile.py index 77de584..675295a 100755 --- a/tests/testcompile.py +++ b/tests/testcompile.py @@ -89,7 +89,29 @@ class TestCompile(unittest.TestCase): comp_dir = os.path.join(self.tmpdir, 'cprog') compile('setup', local_cprog_path, comp_dir, expect = 'Created directory') os.chdir(comp_dir) + compile('diff', expect = "No local src directory to diff against") + compile('diff', 'foo', expect = 'usage') + compile('copy-src', 'foo', expect = 'usage') + compile('copy-src', expect = 'Copied as') + compile('copy-src', expect = "Directory '") + compile('diff') compile('build', expect = 'Hello from C') + target_dir = 'dist-%s' % support.get_arch_name().lower() + patch_file = os.path.join(target_dir, '0install/from-0.1.patch') + assert not os.path.exists(patch_file) + + prog = file('src/main.c').read() + prog = prog.replace('Hello', 'Goodbye') + stream = file('src/main.c', 'w') + stream.write(prog) + stream.close() + compile('diff', expect = 'diff') + + compile('build', expect = 'Goodbye from C') + assert os.path.exists(patch_file) + shutil.rmtree('src') + compile('build', expect = 'Hello from C') + assert not os.path.exists(patch_file) suite = unittest.makeSuite(TestCompile) if __name__ == '__main__': -- 2.11.4.GIT