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

Unified Diff: ios/build/packaging/link_dependencies_test.py

Issue 1125293004: ios: add CrNet (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix last nits Created 5 years, 7 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
« no previous file with comments | « ios/build/packaging/link_dependencies.py ('k') | ios/crnet/CrNet.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/build/packaging/link_dependencies_test.py
diff --git a/ios/build/packaging/link_dependencies_test.py b/ios/build/packaging/link_dependencies_test.py
new file mode 100755
index 0000000000000000000000000000000000000000..d4159e41ef92e540ff5ad36d94f5959ca0f2dcf4
--- /dev/null
+++ b/ios/build/packaging/link_dependencies_test.py
@@ -0,0 +1,102 @@
+#!/usr/bin/env python
+# 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.
+
+from link_dependencies import extract_inputs, library_deps
+import unittest
+
+
+class ExtractInputsTest(unittest.TestCase):
+ def test_empty(self):
+ self.assertListEqual([], extract_inputs(''))
+ query_result = '\n'.join([
+ 'header',
+ ' input: link',
+ ' outputs: nothing',
+ 'footer'
+ ])
+ self.assertListEqual([], extract_inputs(query_result))
+
+ def test_one_input(self):
+ query_result = '\n'.join([
+ 'header',
+ ' input: link',
+ ' foo',
+ ' outputs: link',
+ ' quxx',
+ 'footer'
+ ])
+ self.assertListEqual(['foo'], extract_inputs(query_result))
+
+ def test_many_inputs(self):
+ query_result = '\n'.join([
+ 'header',
+ ' input: link',
+ ' foo',
+ ' bar',
+ ' baz',
+ ' outputs:',
+ ' quxx',
+ 'footer'
+ ])
+ self.assertListEqual(['foo', 'bar', 'baz'], extract_inputs(query_result))
+
+ def test_no_pipe_inputs(self):
+ query_result = '\n'.join([
+ 'header',
+ ' input: link',
+ ' |foo',
+ ' bar',
+ ' |baz',
+ ' outputs:',
+ ' quxx',
+ 'footer'
+ ])
+ self.assertListEqual(['bar'], extract_inputs(query_result))
+
+ def test_prefix(self):
+ query_result = '\n'.join([
+ 'header',
+ ' input: link',
+ ' bar',
+ ' outputs:',
+ 'footer'
+ ])
+ self.assertListEqual(['foo/bar'],
+ extract_inputs(query_result, 'foo/'))
+
+
+class LibraryDepsTest(unittest.TestCase):
+ def mkquery(self, answers):
+ """Creates a query function for library_deps.
+
+ Creates a query function for library_deps that returns answers from the
+ supplied map.
+ """
+ return lambda target, unused_workdir, unused_prefix='': answers[target]
+
+ def test_empty(self):
+ self.assertEqual(set(), library_deps([], 'wd', self.mkquery({})))
+
+ def test_nonarch(self):
+ deps = ['abc.a', 'def.o', 'abc.a']
+ self.assertEqual({'wd/abc.a', 'wd/def.o'},
+ library_deps(deps, 'wd', self.mkquery({})))
+
+ def test_arch(self):
+ dep_map = {'abc': ['wd/def.a', 'wd/ghi.o']}
+ deps = ['abc', 'jkl.o']
+ self.assertEqual({'wd/def.a', 'wd/ghi.o', 'wd/jkl.o'},
+ library_deps(deps, 'wd', self.mkquery(dep_map)))
+
+ def test_arch_many(self):
+ dep_map = {'abc': ['wd/def.o', 'wd/ghi.a'],
+ 'def': ['wd/def.o', 'wd/jkl.a']}
+ deps = ['abc', 'def', 'def.o']
+ self.assertEqual({'wd/def.o', 'wd/ghi.a', 'wd/jkl.a'},
+ library_deps(deps, 'wd', self.mkquery(dep_map)))
+
+
+if __name__ == '__main__':
+ unittest.main()
« no previous file with comments | « ios/build/packaging/link_dependencies.py ('k') | ios/crnet/CrNet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698