Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(431)

Unified Diff: mojo/public/tools/bindings/pylib/mojom_tests/parse/translate_unittest.py

Issue 814543006: Move //mojo/{public, edk} underneath //third_party (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: mojo/public/tools/bindings/pylib/mojom_tests/parse/translate_unittest.py
diff --git a/mojo/public/tools/bindings/pylib/mojom_tests/parse/translate_unittest.py b/mojo/public/tools/bindings/pylib/mojom_tests/parse/translate_unittest.py
deleted file mode 100644
index 9f2d985d1fa3767a34b5a613809b62e7a1966cdc..0000000000000000000000000000000000000000
--- a/mojo/public/tools/bindings/pylib/mojom_tests/parse/translate_unittest.py
+++ /dev/null
@@ -1,65 +0,0 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import imp
-import os.path
-import sys
-import unittest
-
-def _GetDirAbove(dirname):
- """Returns the directory "above" this file containing |dirname| (which must
- also be "above" this file)."""
- path = os.path.abspath(__file__)
- while True:
- path, tail = os.path.split(path)
- assert tail
- if tail == dirname:
- return path
-
-try:
- imp.find_module("mojom")
-except ImportError:
- sys.path.append(os.path.join(_GetDirAbove("pylib"), "pylib"))
-from mojom.parse import ast
-from mojom.parse import translate
-
-
-class TranslateTest(unittest.TestCase):
- """Tests |parser.Parse()|."""
-
- def testSimpleArray(self):
- """Tests a simple int32[]."""
- # pylint: disable=W0212
- self.assertEquals(translate._MapKind("int32[]"), "a:i32")
-
- def testAssociativeArray(self):
- """Tests a simple uint8{string}."""
- # pylint: disable=W0212
- self.assertEquals(translate._MapKind("uint8{string}"), "m[s][u8]")
-
- def testLeftToRightAssociativeArray(self):
- """Makes sure that parsing is done from right to left on the internal kinds
- in the presence of an associative array."""
- # pylint: disable=W0212
- self.assertEquals(translate._MapKind("uint8[]{string}"), "m[s][a:u8]")
-
- def testTranslateSimpleUnions(self):
- """Makes sure that a simple union is translated correctly."""
- tree = ast.Mojom(
- None,
- ast.ImportList(),
- [ast.Union("SomeUnion", ast.UnionBody(
- [ast.UnionField("a", None, "int32"),
- ast.UnionField("b", None, "string")]))])
- expected = [{
- "name": "SomeUnion",
- "fields": [
- {"kind": "i32", "name": "a", "ordinal": None},
- {"kind": "s", "name": "b", "ordinal": None}]}]
- actual = translate.Translate(tree, "mojom_tree")
- self.assertEquals(actual["union"], expected)
-
-
-if __name__ == "__main__":
- unittest.main()

Powered by Google App Engine
This is Rietveld 408576698