| Index: tools/push-to-trunk/script_test.py
|
| diff --git a/tools/lexer_generator/test/term_test.py b/tools/push-to-trunk/script_test.py
|
| old mode 100644
|
| new mode 100755
|
| similarity index 69%
|
| copy from tools/lexer_generator/test/term_test.py
|
| copy to tools/push-to-trunk/script_test.py
|
| index 028abc801b4a80febf979e37da571674da19ebd0..cbb2134f6d92f9d7a8c8e7dda3a3a2e9e1c0a45c
|
| --- a/tools/lexer_generator/test/term_test.py
|
| +++ b/tools/push-to-trunk/script_test.py
|
| @@ -1,3 +1,4 @@
|
| +#!/usr/bin/env python
|
| # Copyright 2014 the V8 project authors. All rights reserved.
|
| # Redistribution and use in source and binary forms, with or without
|
| # modification, are permitted provided that the following conditions are
|
| @@ -25,27 +26,29 @@
|
| # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| -import unittest
|
| -from lexer_generator.term import Term
|
| +# Wraps test execution with a coverage analysis. To get the best speed, the
|
| +# native python coverage version >= 3.7.1 should be installed.
|
|
|
| -class TermTestCase(unittest.TestCase):
|
| +import coverage
|
| +import os
|
| +import unittest
|
| +import sys
|
|
|
| - def test_basic(self):
|
|
|
| - t = Term('a')
|
| - self.assertEqual('a', t.name())
|
| - self.assertEqual((), t.args())
|
| - self.assertEqual("a()", str(t))
|
| - self.assertEqual(Term('a'), t)
|
| +def Main(argv):
|
| + script_path = os.path.dirname(os.path.abspath(__file__))
|
| + cov = coverage.coverage(include=([os.path.join(script_path, '*.py')]))
|
| + cov.start()
|
| + import test_scripts
|
| + alltests = map(unittest.TestLoader().loadTestsFromTestCase, [
|
| + test_scripts.ToplevelTest,
|
| + test_scripts.ScriptTest,
|
| + test_scripts.SystemTest,
|
| + ])
|
| + unittest.TextTestRunner(verbosity=2).run(unittest.TestSuite(alltests))
|
| + cov.stop()
|
| + print cov.report()
|
|
|
| - t = Term('a', 'b', 'c')
|
| - self.assertEqual('a', t.name())
|
| - self.assertEqual(('b', 'c'), t.args())
|
| - self.assertEqual("a(b,c)", str(t))
|
| - self.assertEqual(Term('a', 'b', 'c'), t)
|
|
|
| - t = Term('a', Term('b', 'c'))
|
| - self.assertEqual('a', t.name())
|
| - self.assertEqual((Term('b', 'c'), ), t.args())
|
| - self.assertEqual("a(b(c))", str(t))
|
| - self.assertEqual(Term('a', Term('b', 'c')), t)
|
| +if __name__ == '__main__':
|
| + sys.exit(Main(sys.argv))
|
|
|