| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import imp | 5 import imp |
| 6 import os.path | 6 import os.path |
| 7 import sys | 7 import sys |
| 8 import unittest | 8 import unittest |
| 9 | 9 |
| 10 def _GetDirAbove(dirname): | 10 def _GetDirAbove(dirname): |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 ast.ImportList(), | 51 ast.ImportList(), |
| 52 [ast.Union("SomeUnion", ast.UnionBody( | 52 [ast.Union("SomeUnion", ast.UnionBody( |
| 53 [ast.UnionField("a", None, "int32"), | 53 [ast.UnionField("a", None, "int32"), |
| 54 ast.UnionField("b", None, "string")]))]) | 54 ast.UnionField("b", None, "string")]))]) |
| 55 expected = [{ | 55 expected = [{ |
| 56 "name": "SomeUnion", | 56 "name": "SomeUnion", |
| 57 "fields": [ | 57 "fields": [ |
| 58 {"kind": "i32", "name": "a", "ordinal": None}, | 58 {"kind": "i32", "name": "a", "ordinal": None}, |
| 59 {"kind": "s", "name": "b", "ordinal": None}]}] | 59 {"kind": "s", "name": "b", "ordinal": None}]}] |
| 60 actual = translate.Translate(tree, "mojom_tree") | 60 actual = translate.Translate(tree, "mojom_tree") |
| 61 self.assertEquals(actual["unions"], expected) | 61 self.assertEquals(actual["union"], expected) |
| 62 | 62 |
| 63 | 63 |
| 64 if __name__ == "__main__": | 64 if __name__ == "__main__": |
| 65 unittest.main() | 65 unittest.main() |
| OLD | NEW |