OLD | NEW |
1 #! /usr/bin/env python | 1 #! /usr/bin/env python |
2 # | 2 # |
3 # Protocol Buffers - Google's data interchange format | 3 # Protocol Buffers - Google's data interchange format |
4 # Copyright 2008 Google Inc. All rights reserved. | 4 # Copyright 2008 Google Inc. All rights reserved. |
5 # https://developers.google.com/protocol-buffers/ | 5 # https://developers.google.com/protocol-buffers/ |
6 # | 6 # |
7 # Redistribution and use in source and binary forms, with or without | 7 # Redistribution and use in source and binary forms, with or without |
8 # modification, are permitted provided that the following conditions are | 8 # modification, are permitted provided that the following conditions are |
9 # met: | 9 # met: |
10 # | 10 # |
(...skipping 17 matching lines...) Expand all Loading... |
28 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 28 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
29 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 29 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
30 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 30 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
31 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 31 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
32 | 32 |
33 """Negative compilation unit tests for arena API.""" | 33 """Negative compilation unit tests for arena API.""" |
34 | 34 |
35 import unittest | 35 import unittest |
36 | 36 |
37 from google3.testing.pybase import fake_target_util | 37 from google3.testing.pybase import fake_target_util |
38 import unittest | 38 from google3.testing.pybase import unittest |
39 | 39 |
40 | 40 |
41 class ArenaNcTest(unittest.TestCase): | 41 class ArenaNcTest(unittest.TestCase): |
42 | 42 |
43 def testCompilerErrors(self): | 43 def testCompilerErrors(self): |
44 """Runs a list of tests to verify compiler error messages.""" | 44 """Runs a list of tests to verify compiler error messages.""" |
45 | 45 |
46 # Defines a list of test specs, where each element is a tuple | 46 # Defines a list of test specs, where each element is a tuple |
47 # (test name, list of regexes for matching the compiler errors). | 47 # (test name, list of regexes for matching the compiler errors). |
48 test_specs = [ | 48 test_specs = [ |
49 ('ARENA_PRIVATE_CONSTRUCTOR', | 49 ('ARENA_PRIVATE_CONSTRUCTOR', |
50 [r'calling a protected constructor']), | 50 [r'calling a protected constructor']), |
51 ('SANITY', None)] | 51 ('SANITY', None)] |
52 | 52 |
53 fake_target_util.AssertCcCompilerErrors( | 53 fake_target_util.AssertCcCompilerErrors( |
54 self, # The current test case. | 54 self, # The current test case. |
55 'google3/google/protobuf/arena_nc', # The fake target file. | 55 'google3/google/protobuf/arena_nc', # The fake target file. |
56 'arena_nc.o', # The sub-target to build. | 56 'arena_nc.o', # The sub-target to build. |
57 test_specs # List of test specifications. | 57 test_specs # List of test specifications. |
58 ) | 58 ) |
59 | 59 |
60 if __name__ == '__main__': | 60 if __name__ == '__main__': |
61 unittest.main() | 61 unittest.main() |
OLD | NEW |