diff options
author | Matt A. Tobin <email@mattatobin.com> | 2018-02-09 06:46:43 -0500 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2018-02-09 06:46:43 -0500 |
commit | ac46df8daea09899ce30dc8fd70986e258c746bf (patch) | |
tree | 2750d3125fc253fd5b0671e4bd268eff1fd97296 /addon-sdk/source/python-lib/cuddlefish/tests | |
parent | 8cecf8d5208f3945b35f879bba3015bb1a11bec6 (diff) | |
download | UXP-ac46df8daea09899ce30dc8fd70986e258c746bf.tar UXP-ac46df8daea09899ce30dc8fd70986e258c746bf.tar.gz UXP-ac46df8daea09899ce30dc8fd70986e258c746bf.tar.lz UXP-ac46df8daea09899ce30dc8fd70986e258c746bf.tar.xz UXP-ac46df8daea09899ce30dc8fd70986e258c746bf.zip |
Move Add-on SDK source to toolkit/jetpack
Diffstat (limited to 'addon-sdk/source/python-lib/cuddlefish/tests')
127 files changed, 0 insertions, 2233 deletions
diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/__init__.py b/addon-sdk/source/python-lib/cuddlefish/tests/__init__.py deleted file mode 100644 index 60e7e88b3..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/__init__.py +++ /dev/null @@ -1,52 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -import os -import unittest -import doctest -import glob - -env_root = os.environ['CUDDLEFISH_ROOT'] - -def get_tests(): - import cuddlefish - import cuddlefish.tests - - tests = [] - packages = [cuddlefish, cuddlefish.tests] - for package in packages: - path = os.path.abspath(package.__path__[0]) - pynames = glob.glob(os.path.join(path, '*.py')) - for filename in pynames: - basename = os.path.basename(filename) - module_name = os.path.splitext(basename)[0] - full_name = "%s.%s" % (package.__name__, module_name) - module = __import__(full_name, fromlist=[package.__name__]) - - loader = unittest.TestLoader() - suite = loader.loadTestsFromModule(module) - for test in suite: - tests.append(test) - - finder = doctest.DocTestFinder() - doctests = finder.find(module) - for test in doctests: - if len(test.examples) > 0: - tests.append(doctest.DocTestCase(test)) - - return tests - -def run(verbose=False): - if verbose: - verbosity = 2 - else: - verbosity = 1 - - tests = get_tests() - suite = unittest.TestSuite(tests) - runner = unittest.TextTestRunner(verbosity=verbosity) - return runner.run(suite) - -if __name__ == '__main__': - run() diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-588119-files/packages/explicit-icon/explicit-icon.png b/addon-sdk/source/python-lib/cuddlefish/tests/bug-588119-files/packages/explicit-icon/explicit-icon.png deleted file mode 100644 index e69de29bb..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-588119-files/packages/explicit-icon/explicit-icon.png +++ /dev/null diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-588119-files/packages/explicit-icon/explicit-icon64.png b/addon-sdk/source/python-lib/cuddlefish/tests/bug-588119-files/packages/explicit-icon/explicit-icon64.png deleted file mode 100644 index e69de29bb..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-588119-files/packages/explicit-icon/explicit-icon64.png +++ /dev/null diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-588119-files/packages/explicit-icon/lib/main.js b/addon-sdk/source/python-lib/cuddlefish/tests/bug-588119-files/packages/explicit-icon/lib/main.js deleted file mode 100644 index b7e0a1d5e..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-588119-files/packages/explicit-icon/lib/main.js +++ /dev/null @@ -1,4 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-588119-files/packages/explicit-icon/package.json b/addon-sdk/source/python-lib/cuddlefish/tests/bug-588119-files/packages/explicit-icon/package.json deleted file mode 100644 index 8d56d74ba..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-588119-files/packages/explicit-icon/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "loader": "lib/main.js", - "icon": "explicit-icon.png", - "icon64": "explicit-icon64.png" -} diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-588119-files/packages/implicit-icon/icon.png b/addon-sdk/source/python-lib/cuddlefish/tests/bug-588119-files/packages/implicit-icon/icon.png deleted file mode 100644 index e69de29bb..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-588119-files/packages/implicit-icon/icon.png +++ /dev/null diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-588119-files/packages/implicit-icon/icon64.png b/addon-sdk/source/python-lib/cuddlefish/tests/bug-588119-files/packages/implicit-icon/icon64.png deleted file mode 100644 index e69de29bb..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-588119-files/packages/implicit-icon/icon64.png +++ /dev/null diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-588119-files/packages/implicit-icon/lib/main.js b/addon-sdk/source/python-lib/cuddlefish/tests/bug-588119-files/packages/implicit-icon/lib/main.js deleted file mode 100644 index b7e0a1d5e..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-588119-files/packages/implicit-icon/lib/main.js +++ /dev/null @@ -1,4 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-588119-files/packages/implicit-icon/package.json b/addon-sdk/source/python-lib/cuddlefish/tests/bug-588119-files/packages/implicit-icon/package.json deleted file mode 100644 index 3f0e2419f..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-588119-files/packages/implicit-icon/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "loader": "lib/main.js" -} diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-588119-files/packages/no-icon/lib/main.js b/addon-sdk/source/python-lib/cuddlefish/tests/bug-588119-files/packages/no-icon/lib/main.js deleted file mode 100644 index b7e0a1d5e..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-588119-files/packages/no-icon/lib/main.js +++ /dev/null @@ -1,4 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-588119-files/packages/no-icon/package.json b/addon-sdk/source/python-lib/cuddlefish/tests/bug-588119-files/packages/no-icon/package.json deleted file mode 100644 index 3f0e2419f..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-588119-files/packages/no-icon/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "loader": "lib/main.js" -} diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-588661-files/packages/bar/lib/bar-loader.js b/addon-sdk/source/python-lib/cuddlefish/tests/bug-588661-files/packages/bar/lib/bar-loader.js deleted file mode 100644 index b7e0a1d5e..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-588661-files/packages/bar/lib/bar-loader.js +++ /dev/null @@ -1,4 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-588661-files/packages/bar/package.json b/addon-sdk/source/python-lib/cuddlefish/tests/bug-588661-files/packages/bar/package.json deleted file mode 100644 index e83a9d422..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-588661-files/packages/bar/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "loader": "lib/bar-loader.js" -} diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-588661-files/packages/foo/lib/foo-loader.js b/addon-sdk/source/python-lib/cuddlefish/tests/bug-588661-files/packages/foo/lib/foo-loader.js deleted file mode 100644 index b7e0a1d5e..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-588661-files/packages/foo/lib/foo-loader.js +++ /dev/null @@ -1,4 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-588661-files/packages/foo/package.json b/addon-sdk/source/python-lib/cuddlefish/tests/bug-588661-files/packages/foo/package.json deleted file mode 100644 index 4648df67e..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-588661-files/packages/foo/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "loader": "lib/foo-loader.js", - "dependencies": ["bar"] -} diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-611495-files/jspath-one/docs/main.md b/addon-sdk/source/python-lib/cuddlefish/tests/bug-611495-files/jspath-one/docs/main.md deleted file mode 100644 index 54518d38d..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-611495-files/jspath-one/docs/main.md +++ /dev/null @@ -1,5 +0,0 @@ -<!-- This Source Code Form is subject to the terms of the Mozilla Public - - License, v. 2.0. If a copy of the MPL was not distributed with this - - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> - -minimal docs diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-611495-files/jspath-one/lib/main.js b/addon-sdk/source/python-lib/cuddlefish/tests/bug-611495-files/jspath-one/lib/main.js deleted file mode 100644 index aeda0e7fb..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-611495-files/jspath-one/lib/main.js +++ /dev/null @@ -1,8 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -exports.main = function(options, callbacks) { - console.log("minimal"); - callbacks.quit(); -}; diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-611495-files/jspath-one/package.json b/addon-sdk/source/python-lib/cuddlefish/tests/bug-611495-files/jspath-one/package.json deleted file mode 100644 index 45d409a74..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-611495-files/jspath-one/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "jspath-one", - "author": "Jon Smith", - "description": "A package w/ a main module; can be built into an extension." -} diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-614712-files/packages/commonjs-naming/doc/foo.md b/addon-sdk/source/python-lib/cuddlefish/tests/bug-614712-files/packages/commonjs-naming/doc/foo.md deleted file mode 100644 index c92ddb880..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-614712-files/packages/commonjs-naming/doc/foo.md +++ /dev/null @@ -1,5 +0,0 @@ -<!-- This Source Code Form is subject to the terms of the Mozilla Public - - License, v. 2.0. If a copy of the MPL was not distributed with this - - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> - -I am documentation for foo. diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-614712-files/packages/commonjs-naming/lib/foo-loader.js b/addon-sdk/source/python-lib/cuddlefish/tests/bug-614712-files/packages/commonjs-naming/lib/foo-loader.js deleted file mode 100644 index 2daeb3512..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-614712-files/packages/commonjs-naming/lib/foo-loader.js +++ /dev/null @@ -1,5 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - - diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-614712-files/packages/commonjs-naming/package.json b/addon-sdk/source/python-lib/cuddlefish/tests/bug-614712-files/packages/commonjs-naming/package.json deleted file mode 100644 index ccc61b29d..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-614712-files/packages/commonjs-naming/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "loader": "lib/foo-loader.js" -} diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-614712-files/packages/commonjs-naming/test/test-foo.js b/addon-sdk/source/python-lib/cuddlefish/tests/bug-614712-files/packages/commonjs-naming/test/test-foo.js deleted file mode 100644 index bd0cfa96f..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-614712-files/packages/commonjs-naming/test/test-foo.js +++ /dev/null @@ -1,7 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -exports.testThing = function(test) { - test.assertEqual(2, 1 + 1); -}; diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-614712-files/packages/original-naming/docs/foo.md b/addon-sdk/source/python-lib/cuddlefish/tests/bug-614712-files/packages/original-naming/docs/foo.md deleted file mode 100644 index c92ddb880..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-614712-files/packages/original-naming/docs/foo.md +++ /dev/null @@ -1,5 +0,0 @@ -<!-- This Source Code Form is subject to the terms of the Mozilla Public - - License, v. 2.0. If a copy of the MPL was not distributed with this - - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> - -I am documentation for foo. diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-614712-files/packages/original-naming/lib/foo-loader.js b/addon-sdk/source/python-lib/cuddlefish/tests/bug-614712-files/packages/original-naming/lib/foo-loader.js deleted file mode 100644 index 2daeb3512..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-614712-files/packages/original-naming/lib/foo-loader.js +++ /dev/null @@ -1,5 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - - diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-614712-files/packages/original-naming/package.json b/addon-sdk/source/python-lib/cuddlefish/tests/bug-614712-files/packages/original-naming/package.json deleted file mode 100644 index ccc61b29d..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-614712-files/packages/original-naming/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "loader": "lib/foo-loader.js" -} diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-614712-files/packages/original-naming/tests/test-foo.js b/addon-sdk/source/python-lib/cuddlefish/tests/bug-614712-files/packages/original-naming/tests/test-foo.js deleted file mode 100644 index bd0cfa96f..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-614712-files/packages/original-naming/tests/test-foo.js +++ /dev/null @@ -1,7 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -exports.testThing = function(test) { - test.assertEqual(2, 1 + 1); -}; diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/default-lib/doc/foo.md b/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/default-lib/doc/foo.md deleted file mode 100644 index c92ddb880..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/default-lib/doc/foo.md +++ /dev/null @@ -1,5 +0,0 @@ -<!-- This Source Code Form is subject to the terms of the Mozilla Public - - License, v. 2.0. If a copy of the MPL was not distributed with this - - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> - -I am documentation for foo. diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/default-lib/lib/foo.js b/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/default-lib/lib/foo.js deleted file mode 100644 index 2daeb3512..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/default-lib/lib/foo.js +++ /dev/null @@ -1,5 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - - diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/default-lib/lib/loader.js b/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/default-lib/lib/loader.js deleted file mode 100644 index 2daeb3512..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/default-lib/lib/loader.js +++ /dev/null @@ -1,5 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - - diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/default-lib/package.json b/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/default-lib/package.json deleted file mode 100644 index c2d22aa6f..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/default-lib/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "loader": "lib/loader.js" -} diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/default-lib/test/test-foo.js b/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/default-lib/test/test-foo.js deleted file mode 100644 index bd0cfa96f..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/default-lib/test/test-foo.js +++ /dev/null @@ -1,7 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -exports.testThing = function(test) { - test.assertEqual(2, 1 + 1); -}; diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/default-locale/locale/emptyFolder b/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/default-locale/locale/emptyFolder deleted file mode 100644 index e69de29bb..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/default-locale/locale/emptyFolder +++ /dev/null diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/default-locale/package.json b/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/default-locale/package.json deleted file mode 100644 index 0967ef424..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/default-locale/package.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/default-root/doc/foo.md b/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/default-root/doc/foo.md deleted file mode 100644 index c92ddb880..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/default-root/doc/foo.md +++ /dev/null @@ -1,5 +0,0 @@ -<!-- This Source Code Form is subject to the terms of the Mozilla Public - - License, v. 2.0. If a copy of the MPL was not distributed with this - - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> - -I am documentation for foo. diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/default-root/foo.js b/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/default-root/foo.js deleted file mode 100644 index 2daeb3512..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/default-root/foo.js +++ /dev/null @@ -1,5 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - - diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/default-root/loader.js b/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/default-root/loader.js deleted file mode 100644 index 2daeb3512..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/default-root/loader.js +++ /dev/null @@ -1,5 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - - diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/default-root/package.json b/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/default-root/package.json deleted file mode 100644 index 100249fed..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/default-root/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "loader": "loader.js" -} diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/default-root/test/test-foo.js b/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/default-root/test/test-foo.js deleted file mode 100644 index bd0cfa96f..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/default-root/test/test-foo.js +++ /dev/null @@ -1,7 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -exports.testThing = function(test) { - test.assertEqual(2, 1 + 1); -}; diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-dir-lib/alt-lib/foo.js b/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-dir-lib/alt-lib/foo.js deleted file mode 100644 index 2daeb3512..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-dir-lib/alt-lib/foo.js +++ /dev/null @@ -1,5 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - - diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-dir-lib/alt-lib/loader.js b/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-dir-lib/alt-lib/loader.js deleted file mode 100644 index 2daeb3512..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-dir-lib/alt-lib/loader.js +++ /dev/null @@ -1,5 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - - diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-dir-lib/doc/foo.md b/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-dir-lib/doc/foo.md deleted file mode 100644 index c92ddb880..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-dir-lib/doc/foo.md +++ /dev/null @@ -1,5 +0,0 @@ -<!-- This Source Code Form is subject to the terms of the Mozilla Public - - License, v. 2.0. If a copy of the MPL was not distributed with this - - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> - -I am documentation for foo. diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-dir-lib/package.json b/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-dir-lib/package.json deleted file mode 100644 index f79250e6e..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-dir-lib/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "directories": { "lib": "./alt-lib" }, - "loader": "alt-lib/loader.js" -} diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-dir-lib/test/test-foo.js b/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-dir-lib/test/test-foo.js deleted file mode 100644 index bd0cfa96f..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-dir-lib/test/test-foo.js +++ /dev/null @@ -1,7 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -exports.testThing = function(test) { - test.assertEqual(2, 1 + 1); -}; diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-lib/alt2-lib/foo.js b/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-lib/alt2-lib/foo.js deleted file mode 100644 index 2daeb3512..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-lib/alt2-lib/foo.js +++ /dev/null @@ -1,5 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - - diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-lib/alt2-lib/loader.js b/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-lib/alt2-lib/loader.js deleted file mode 100644 index 2daeb3512..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-lib/alt2-lib/loader.js +++ /dev/null @@ -1,5 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - - diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-lib/doc/foo.md b/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-lib/doc/foo.md deleted file mode 100644 index c92ddb880..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-lib/doc/foo.md +++ /dev/null @@ -1,5 +0,0 @@ -<!-- This Source Code Form is subject to the terms of the Mozilla Public - - License, v. 2.0. If a copy of the MPL was not distributed with this - - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> - -I am documentation for foo. diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-lib/package.json b/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-lib/package.json deleted file mode 100644 index b017baa86..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-lib/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "lib": "./alt2-lib", - "loader": "alt2-lib/loader.js" -} diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-lib/test/test-foo.js b/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-lib/test/test-foo.js deleted file mode 100644 index bd0cfa96f..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-lib/test/test-foo.js +++ /dev/null @@ -1,7 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -exports.testThing = function(test) { - test.assertEqual(2, 1 + 1); -}; diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-669274-files/packages/extra-options/docs/main.md b/addon-sdk/source/python-lib/cuddlefish/tests/bug-669274-files/packages/extra-options/docs/main.md deleted file mode 100644 index 54518d38d..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-669274-files/packages/extra-options/docs/main.md +++ /dev/null @@ -1,5 +0,0 @@ -<!-- This Source Code Form is subject to the terms of the Mozilla Public - - License, v. 2.0. If a copy of the MPL was not distributed with this - - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> - -minimal docs diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-669274-files/packages/extra-options/lib/main.js b/addon-sdk/source/python-lib/cuddlefish/tests/bug-669274-files/packages/extra-options/lib/main.js deleted file mode 100644 index aeda0e7fb..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-669274-files/packages/extra-options/lib/main.js +++ /dev/null @@ -1,8 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -exports.main = function(options, callbacks) { - console.log("minimal"); - callbacks.quit(); -}; diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-669274-files/packages/extra-options/package.json b/addon-sdk/source/python-lib/cuddlefish/tests/bug-669274-files/packages/extra-options/package.json deleted file mode 100644 index de868f776..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-669274-files/packages/extra-options/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "extra-options", - "author": "Jon Smith", - "description": "A package w/ a main module; can be built into an extension.", - "loader": "lib/main.js" -} diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-715340-files/pkg-1-pack/package.json b/addon-sdk/source/python-lib/cuddlefish/tests/bug-715340-files/pkg-1-pack/package.json deleted file mode 100644 index afa13e9e5..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-715340-files/pkg-1-pack/package.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "empty", - "license": "MPL-2.0", - "author": "", - "version": "0.1", - "title": "empty", - "id": "jid1-80fr8b6qeRlQSQ", - "unpack": false, - "description": "test unpack= support" -} diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-715340-files/pkg-2-unpack/package.json b/addon-sdk/source/python-lib/cuddlefish/tests/bug-715340-files/pkg-2-unpack/package.json deleted file mode 100644 index b1f76edcd..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-715340-files/pkg-2-unpack/package.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "empty", - "license": "MPL-2.0", - "author": "", - "version": "0.1", - "title": "empty", - "id": "jid1-80fr8b6qeRlQSQ", - "unpack": true, - "description": "test unpack= support" -} diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-715340-files/pkg-3-pack/package.json b/addon-sdk/source/python-lib/cuddlefish/tests/bug-715340-files/pkg-3-pack/package.json deleted file mode 100644 index e3dd9fb72..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-715340-files/pkg-3-pack/package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "empty", - "license": "MPL-2.0", - "author": "", - "version": "0.1", - "title": "empty", - "id": "jid1-80fr8b6qeRlQSQ", - "description": "test unpack= support" -} diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-906359-files/fullName/package.json b/addon-sdk/source/python-lib/cuddlefish/tests/bug-906359-files/fullName/package.json deleted file mode 100644 index 2525a1497..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-906359-files/fullName/package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "empty", - "license": "MPL-2.0", - "author": "", - "version": "0.1", - "fullName": "a long fullName", - "id": "jid1-80123", - "description": "test addon name fallback to 'fullName' key" -} diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-906359-files/none/package.json b/addon-sdk/source/python-lib/cuddlefish/tests/bug-906359-files/none/package.json deleted file mode 100644 index b05025c72..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-906359-files/none/package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "a long none", - "license": "MPL-2.0", - "author": "", - "version": "0.1", - - "id": "jid1-80123", - "description": "test addon name falls back all the way to the 'name' key" -} diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/bug-906359-files/title/package.json b/addon-sdk/source/python-lib/cuddlefish/tests/bug-906359-files/title/package.json deleted file mode 100644 index 634817b7a..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/bug-906359-files/title/package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "empty", - "license": "MPL-2.0", - "author": "", - "version": "0.1", - "title": "a long title", - "id": "jid1-80123", - "description": "test addon name comes from the 'title' key" -} diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/e10s-adapter-files/packages/foo/lib/bar-e10s-adapter.js b/addon-sdk/source/python-lib/cuddlefish/tests/e10s-adapter-files/packages/foo/lib/bar-e10s-adapter.js deleted file mode 100644 index ad54ae76d..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/e10s-adapter-files/packages/foo/lib/bar-e10s-adapter.js +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -if (this.sendMessage) { -} else { - require('bar'); - - exports.register = function(process) { - }; -} diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/e10s-adapter-files/packages/foo/lib/bar.js b/addon-sdk/source/python-lib/cuddlefish/tests/e10s-adapter-files/packages/foo/lib/bar.js deleted file mode 100644 index fe9e4fb72..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/e10s-adapter-files/packages/foo/lib/bar.js +++ /dev/null @@ -1,5 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -require('chrome'); diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/e10s-adapter-files/packages/foo/lib/foo.js b/addon-sdk/source/python-lib/cuddlefish/tests/e10s-adapter-files/packages/foo/lib/foo.js deleted file mode 100644 index 55633d167..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/e10s-adapter-files/packages/foo/lib/foo.js +++ /dev/null @@ -1,5 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -require('bar'); diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/e10s-adapter-files/packages/foo/package.json b/addon-sdk/source/python-lib/cuddlefish/tests/e10s-adapter-files/packages/foo/package.json deleted file mode 100644 index 0967ef424..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/e10s-adapter-files/packages/foo/package.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/five/lib/main.js b/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/five/lib/main.js deleted file mode 100644 index e32a30f9c..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/five/lib/main.js +++ /dev/null @@ -1,5 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -exports.main = "'main' mainly reigns in main(.js)"; diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/five/package.json b/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/five/package.json deleted file mode 100644 index 98e4b85aa..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/five/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ "name": "five", - "main": "./lib/main" -} diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/four-deps/four-a/lib/misc.js b/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/four-deps/four-a/lib/misc.js deleted file mode 100644 index 7e1ce7ea0..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/four-deps/four-a/lib/misc.js +++ /dev/null @@ -1,5 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -exports.main = 42; diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/four-deps/four-a/package.json b/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/four-deps/four-a/package.json deleted file mode 100644 index 3010fae71..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/four-deps/four-a/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ "name": "four-a", - "directories": {"lib": "lib"}, - "main": "./topfiles/main.js" -} diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/four-deps/four-a/topfiles/main.js b/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/four-deps/four-a/topfiles/main.js deleted file mode 100644 index 7e1ce7ea0..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/four-deps/four-a/topfiles/main.js +++ /dev/null @@ -1,5 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -exports.main = 42; diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/four/lib/main.js b/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/four/lib/main.js deleted file mode 100644 index b95f7bd53..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/four/lib/main.js +++ /dev/null @@ -1,5 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -var a = require("four-a"); diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/four/package.json b/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/four/package.json deleted file mode 100644 index 53180b9f6..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/four/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ "name": "four", - "main": "main" -} diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/one/lib/main.js b/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/one/lib/main.js deleted file mode 100644 index 08b9245c5..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/one/lib/main.js +++ /dev/null @@ -1,9 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -var panel = require("sdk/panel"); -var two = require("two.js"); -var a = require("./two"); -var b = require("sdk/tabs.js"); -var c = require("./subdir/three"); diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/one/lib/subdir/three.js b/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/one/lib/subdir/three.js deleted file mode 100644 index b594f3c68..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/one/lib/subdir/three.js +++ /dev/null @@ -1,6 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -exports.foo = 1; -var main = require("../main"); diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/one/lib/two.js b/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/one/lib/two.js deleted file mode 100644 index 976521958..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/one/lib/two.js +++ /dev/null @@ -1,8 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - - -// this ought to find our sibling, not packages/development-mode/lib/main.js -var main = require("main"); -exports.foo = 1; diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/one/package.json b/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/one/package.json deleted file mode 100644 index edd2b17c8..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/one/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ "name": "one", - "id": "jid1@jetpack", - "main": "main" -} diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/seven/data/text.data b/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/seven/data/text.data deleted file mode 100644 index 1269488f7..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/seven/data/text.data +++ /dev/null @@ -1 +0,0 @@ -data diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/seven/lib/main.js b/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/seven/lib/main.js deleted file mode 100644 index b1d68d3a0..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/seven/lib/main.js +++ /dev/null @@ -1,6 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -var self = require("sdk/self"); // trigger inclusion of data -exports.main = function () { console.log("main"); }; diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/seven/lib/unused.js b/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/seven/lib/unused.js deleted file mode 100644 index a7b1c1449..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/seven/lib/unused.js +++ /dev/null @@ -1,5 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -exports.unused = "just pretend I'm not here"; diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/seven/package.json b/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/seven/package.json deleted file mode 100644 index 922c77dfc..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/seven/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "seven", - "id": "jid7" -} diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/six/lib/unused.js b/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/six/lib/unused.js deleted file mode 100644 index ada31ef8c..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/six/lib/unused.js +++ /dev/null @@ -1,5 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -exports.unused = "I am."; diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/six/package.json b/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/six/package.json deleted file mode 100644 index 906b24927..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/six/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ "name": "six", - "main": "./unreachable" -} diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/six/unreachable.js b/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/six/unreachable.js deleted file mode 100644 index e8b229cde..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/six/unreachable.js +++ /dev/null @@ -1,5 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -exports.main = "I am outside lib/ and cannot be reached, yet"; diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three-deps/three-a/lib/main.js b/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three-deps/three-a/lib/main.js deleted file mode 100644 index 54e4b7efb..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three-deps/three-a/lib/main.js +++ /dev/null @@ -1,8 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -exports.main = 42; -require("./subdir/subfile"); -require("sdk/self"); // trigger inclusion of our data/ directory - diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three-deps/three-a/lib/subdir/subfile.js b/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three-deps/three-a/lib/subdir/subfile.js deleted file mode 100644 index aec24d01b..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three-deps/three-a/lib/subdir/subfile.js +++ /dev/null @@ -1,5 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -exports.main = "I should be included in a subdir"; diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three-deps/three-a/lib/unused.js b/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three-deps/three-a/lib/unused.js deleted file mode 100644 index 36c4a4e2b..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three-deps/three-a/lib/unused.js +++ /dev/null @@ -1,5 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -exports.main = "unused, linker should not include me in the XPI"; diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three-deps/three-a/locale/fr-FR.properties b/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three-deps/three-a/locale/fr-FR.properties deleted file mode 100644 index 980ac46c6..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three-deps/three-a/locale/fr-FR.properties +++ /dev/null @@ -1,5 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -Yes= Oui diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three-deps/three-a/package.json b/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three-deps/three-a/package.json deleted file mode 100644 index 6b796fc33..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three-deps/three-a/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ "name": "three-a", - "main": "./lib/main.js" -} diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three-deps/three-b/lib/main.js b/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three-deps/three-b/lib/main.js deleted file mode 100644 index 7e1ce7ea0..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three-deps/three-b/lib/main.js +++ /dev/null @@ -1,5 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -exports.main = 42; diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three-deps/three-b/locale/fr-FR.properties b/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three-deps/three-b/locale/fr-FR.properties deleted file mode 100644 index c1bf1465f..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three-deps/three-b/locale/fr-FR.properties +++ /dev/null @@ -1,6 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -No= Non -one= un diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three-deps/three-b/package.json b/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three-deps/three-b/package.json deleted file mode 100644 index c0ff5ee0e..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three-deps/three-b/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ "name": "three-b", - "main": "./lib/main" -} diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three-deps/three-c/lib/main.js b/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three-deps/three-c/lib/main.js deleted file mode 100644 index 7e1ce7ea0..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three-deps/three-c/lib/main.js +++ /dev/null @@ -1,5 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -exports.main = 42; diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three-deps/three-c/lib/sub/foo.js b/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three-deps/three-c/lib/sub/foo.js deleted file mode 100644 index 587849615..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three-deps/three-c/lib/sub/foo.js +++ /dev/null @@ -1,6 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -exports.foo = "you found me down here"; - diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three-deps/three-c/locale/fr-FR.properties b/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three-deps/three-c/locale/fr-FR.properties deleted file mode 100644 index dac3f133b..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three-deps/three-c/locale/fr-FR.properties +++ /dev/null @@ -1,9 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -No= Nein -What?= Quoi? -plural=other -plural[one]=one -uft8_value=é diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three-deps/three-c/package.json b/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three-deps/three-c/package.json deleted file mode 100644 index 169c9146b..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three-deps/three-c/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ "name": "three-c", - "main": "lib/main" -} diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three/data/msg.txt b/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three/data/msg.txt deleted file mode 100644 index 3b18e512d..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three/data/msg.txt +++ /dev/null @@ -1 +0,0 @@ -hello world diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three/data/subdir/submsg.txt b/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three/data/subdir/submsg.txt deleted file mode 100644 index d2cfe80de..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three/data/subdir/submsg.txt +++ /dev/null @@ -1 +0,0 @@ -hello subdir diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three/lib/main.js b/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three/lib/main.js deleted file mode 100644 index 4f5944374..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three/lib/main.js +++ /dev/null @@ -1,8 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -var a = require("three-a"); -var b = require("three-b"); -var c = require("three-c"); -var c3 = require("three-c/sub/foo"); diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three/package.json b/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three/package.json deleted file mode 100644 index cbfbc5bb2..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ "name": "three", - "main": "main" -} diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three/tests/nontest.js b/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three/tests/nontest.js deleted file mode 100644 index edbc08ef2..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three/tests/nontest.js +++ /dev/null @@ -1,5 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -// dummy diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three/tests/test-one.js b/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three/tests/test-one.js deleted file mode 100644 index edbc08ef2..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three/tests/test-one.js +++ /dev/null @@ -1,5 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -// dummy diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three/tests/test-two.js b/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three/tests/test-two.js deleted file mode 100644 index edbc08ef2..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/linker-files/three/tests/test-two.js +++ /dev/null @@ -1,5 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -// dummy diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/aardvark/doc/main.md b/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/aardvark/doc/main.md deleted file mode 100644 index e69de29bb..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/aardvark/doc/main.md +++ /dev/null diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/aardvark/lib/ignore_me b/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/aardvark/lib/ignore_me deleted file mode 100644 index 014242c92..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/aardvark/lib/ignore_me +++ /dev/null @@ -1,3 +0,0 @@ -The docs processor should tolerate (by ignoring) random non-.js files in lib -directories, such as those left around by editors, version-control systems, -or OS metadata like .DS_Store . This file exercises that tolerance. diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/aardvark/lib/main.js b/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/aardvark/lib/main.js deleted file mode 100644 index 026487257..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/aardvark/lib/main.js +++ /dev/null @@ -1,8 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -exports.main = function(options, callbacks) { - console.log("1 + 1 =", require("bar-module").add(1, 1)); - callbacks.quit(); -}; diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/aardvark/lib/surprise.js/ignore_me_too b/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/aardvark/lib/surprise.js/ignore_me_too deleted file mode 100644 index 066f9b55d..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/aardvark/lib/surprise.js/ignore_me_too +++ /dev/null @@ -1,2 +0,0 @@ -The docs processor should also ignore directories named *.js, and their -contents. diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/aardvark/package.json b/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/aardvark/package.json deleted file mode 100644 index afb5698e9..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/aardvark/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "author": "Jon Smith", - "description": "A package w/ a main module; can be built into an extension.", - "keywords": ["potato"], - "version": "1.0", - "dependencies": ["addon-sdk", "barbeque"] -} diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/anteater_files/lib/main.js b/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/anteater_files/lib/main.js deleted file mode 100644 index 026487257..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/anteater_files/lib/main.js +++ /dev/null @@ -1,8 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -exports.main = function(options, callbacks) { - console.log("1 + 1 =", require("bar-module").add(1, 1)); - callbacks.quit(); -}; diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/anteater_files/package.json b/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/anteater_files/package.json deleted file mode 100644 index 9684581da..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/anteater_files/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "anteater", - "author": "Jon Smith", - "description": "A package w/ a main module; can be built into an extension.", - "keywords": ["potato"], - "version": "1.0", - "dependencies": ["addon-sdk", "barbeque"] -} diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/api-utils/lib/loader.js b/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/api-utils/lib/loader.js deleted file mode 100644 index 361846d27..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/api-utils/lib/loader.js +++ /dev/null @@ -1,7 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -// This module will be imported by the XPCOM harness/boostrapper -// via Components.utils.import() and is responsible for creating a -// CommonJS module loader. diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/api-utils/package.json b/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/api-utils/package.json deleted file mode 100644 index 64eb065be..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/api-utils/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "description": "A foundational package that provides a CommonJS module loader implementation.", - "keywords": ["potato", "jetpack-low-level"], - "loader": "lib/loader.js" -} diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/barbeque/lib/bar-module.js b/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/barbeque/lib/bar-module.js deleted file mode 100644 index ff982ae20..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/barbeque/lib/bar-module.js +++ /dev/null @@ -1,7 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -exports.add = function add(a, b) { - return a + b; -}; diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/barbeque/package.json b/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/barbeque/package.json deleted file mode 100644 index 62e3c12d7..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/barbeque/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "keywords": ["potato", "jetpack-low-level"], - "description": "A package used by 'aardvark' as a library." -} diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/minimal/lib/main.js b/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/minimal/lib/main.js deleted file mode 100644 index aeda0e7fb..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/minimal/lib/main.js +++ /dev/null @@ -1,8 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -exports.main = function(options, callbacks) { - console.log("minimal"); - callbacks.quit(); -}; diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/minimal/package.json b/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/minimal/package.json deleted file mode 100644 index 530f3c247..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/minimal/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "author": "Jon Smith", - "description": "A package w/ a main module; can be built into an extension." -} diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/third_party/docs/third_party.md b/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/third_party/docs/third_party.md deleted file mode 100644 index 35152f601..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/third_party/docs/third_party.md +++ /dev/null @@ -1 +0,0 @@ -hello, I'm a third party.
\ No newline at end of file diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/third_party/lib/third-party.js b/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/third_party/lib/third-party.js deleted file mode 100644 index 026487257..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/third_party/lib/third-party.js +++ /dev/null @@ -1,8 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -exports.main = function(options, callbacks) { - console.log("1 + 1 =", require("bar-module").add(1, 1)); - callbacks.quit(); -}; diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/third_party/package.json b/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/third_party/package.json deleted file mode 100644 index afb5698e9..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/static-files/packages/third_party/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "author": "Jon Smith", - "description": "A package w/ a main module; can be built into an extension.", - "keywords": ["potato"], - "version": "1.0", - "dependencies": ["addon-sdk", "barbeque"] -} diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/static-files/xpi-template/components/harness.js b/addon-sdk/source/python-lib/cuddlefish/tests/static-files/xpi-template/components/harness.js deleted file mode 100644 index a20bf3fe6..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/static-files/xpi-template/components/harness.js +++ /dev/null @@ -1,8 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -// This file contains XPCOM code that bootstraps an SDK-based add-on -// by loading its harness-options.json, registering all its resource -// directories, executing its loader, and then executing its program's -// main() function. diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/test_init.py b/addon-sdk/source/python-lib/cuddlefish/tests/test_init.py deleted file mode 100644 index 5ececfea6..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/test_init.py +++ /dev/null @@ -1,211 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -import os, unittest, shutil -import zipfile -from StringIO import StringIO -from cuddlefish import initializer -from cuddlefish.templates import TEST_MAIN_JS, PACKAGE_JSON - -tests_path = os.path.abspath(os.path.dirname(__file__)) - -class TestInit(unittest.TestCase): - - def run_init_in_subdir(self, dirname, f, *args, **kwargs): - top = os.path.abspath(os.getcwd()) - basedir = os.path.abspath(os.path.join(".test_tmp",self.id(),dirname)) - if os.path.isdir(basedir): - assert basedir.startswith(top) - shutil.rmtree(basedir) - os.makedirs(basedir) - try: - os.chdir(basedir) - return f(basedir, *args, **kwargs) - finally: - os.chdir(top) - - def do_test_init(self,basedir): - # Let's init the addon, no error admitted - f = open(".ignoreme","w") - f.write("stuff") - f.close() - - out, err = StringIO(), StringIO() - init_run = initializer(None, ["init"], out, err) - out, err = out.getvalue(), err.getvalue() - self.assertEqual(init_run["result"], 0) - self.assertTrue("* lib directory created" in out) - self.assertTrue("* data directory created" in out) - self.assertTrue("Have fun!" in out) - self.assertEqual(err,"") - self.assertTrue(len(os.listdir(basedir))>0) - main_js = os.path.join(basedir,"lib","main.js") - package_json = os.path.join(basedir,"package.json") - test_main_js = os.path.join(basedir,"test","test-main.js") - self.assertTrue(os.path.exists(main_js)) - self.assertTrue(os.path.exists(package_json)) - self.assertTrue(os.path.exists(test_main_js)) - self.assertEqual(open(main_js,"r").read(),"") - self.assertEqual(open(package_json,"r").read() % {"id":"tmp_addon_id" }, - PACKAGE_JSON % {"name":"tmp_addon_sample", - "title": "tmp_addon_SAMPLE", - "id":init_run["jid"] }) - self.assertEqual(open(test_main_js,"r").read(),TEST_MAIN_JS) - - # Let's check that the addon is initialized - out, err = StringIO(), StringIO() - init_run = initializer(None, ["init"], out, err) - out, err = out.getvalue(), err.getvalue() - self.failIfEqual(init_run["result"],0) - self.assertTrue("This command must be run in an empty directory." in err) - - def test_initializer(self): - self.run_init_in_subdir("tmp_addon_SAMPLE",self.do_test_init) - - def do_test_args(self, basedir): - # check that running it with spurious arguments will fail - out,err = StringIO(), StringIO() - init_run = initializer(None, ["init", "specified-dirname", "extra-arg"], out, err) - out, err = out.getvalue(), err.getvalue() - self.failIfEqual(init_run["result"], 0) - self.assertTrue("Too many arguments" in err) - - def test_args(self): - self.run_init_in_subdir("tmp_addon_sample", self.do_test_args) - - def _test_existing_files(self, basedir): - f = open("pay_attention_to_me","w") - f.write("stuff") - f.close() - out,err = StringIO(), StringIO() - rc = initializer(None, ["init"], out, err) - out, err = out.getvalue(), err.getvalue() - self.assertEqual(rc["result"], 1) - self.failUnless("This command must be run in an empty directory" in err, - err) - self.failIf(os.path.exists("lib")) - - def test_existing_files(self): - self.run_init_in_subdir("existing_files", self._test_existing_files) - - def test_init_subdir(self): - parent = os.path.abspath(os.path.join(".test_tmp", self.id())) - basedir = os.path.join(parent, "init-basedir") - if os.path.exists(parent): - shutil.rmtree(parent) - os.makedirs(parent) - - # if the basedir exists and is not empty, init should refuse - os.makedirs(basedir) - f = open(os.path.join(basedir, "boo"), "w") - f.write("stuff") - f.close() - out, err = StringIO(), StringIO() - rc = initializer(None, ["init", basedir], out, err) - out, err = out.getvalue(), err.getvalue() - self.assertEqual(rc["result"], 1) - self.assertTrue("testing if directory is empty" in out, out) - self.assertTrue("This command must be run in an empty directory." in err, - err) - - # a .dotfile should be tolerated - os.rename(os.path.join(basedir, "boo"), os.path.join(basedir, ".phew")) - out, err = StringIO(), StringIO() - rc = initializer(None, ["init", basedir], out, err) - out, err = out.getvalue(), err.getvalue() - self.assertEqual(rc["result"], 0) - self.assertTrue("* data directory created" in out, out) - self.assertTrue("Have fun!" in out) - self.assertEqual(err,"") - self.assertTrue(os.listdir(basedir)) - main_js = os.path.join(basedir,"lib","main.js") - package_json = os.path.join(basedir,"package.json") - self.assertTrue(os.path.exists(main_js)) - self.assertTrue(os.path.exists(package_json)) - shutil.rmtree(basedir) - - # init should create directories that don't exist already - out, err = StringIO(), StringIO() - rc = initializer(None, ["init", basedir], out, err) - out, err = out.getvalue(), err.getvalue() - self.assertEqual(rc["result"], 0) - self.assertTrue("* data directory created" in out) - self.assertTrue("Have fun!" in out) - self.assertEqual(err,"") - self.assertTrue(os.listdir(basedir)) - main_js = os.path.join(basedir,"lib","main.js") - package_json = os.path.join(basedir,"package.json") - self.assertTrue(os.path.exists(main_js)) - self.assertTrue(os.path.exists(package_json)) - - -class TestCfxQuits(unittest.TestCase): - - def run_cfx(self, addon_path, command): - old_cwd = os.getcwd() - os.chdir(addon_path) - import sys - old_stdout = sys.stdout - old_stderr = sys.stderr - sys.stdout = out = StringIO() - sys.stderr = err = StringIO() - rc = 0 - try: - import cuddlefish - args = list(command) - # Pass arguments given to cfx so that cfx can find firefox path - # if --binary option is given: - args.extend(sys.argv[1:]) - cuddlefish.run(arguments=args) - except SystemExit, e: - if "code" in e: - rc = e.code - elif "args" in e and len(e.args)>0: - rc = e.args[0] - else: - rc = 0 - finally: - sys.stdout = old_stdout - sys.stderr = old_stderr - os.chdir(old_cwd) - out.flush() - err.flush() - return rc, out.getvalue(), err.getvalue() - - # this method doesn't exists in python 2.5, - # implements our own - def assertIn(self, member, container): - """Just like self.assertTrue(a in b), but with a nicer default message.""" - if member not in container: - standardMsg = '"%s" not found in "%s"' % (member, - container) - self.fail(standardMsg) - - def test_cfx_init(self): - # Create an empty test directory - addon_path = os.path.abspath(os.path.join(".test_tmp", "test-cfx-init")) - if os.path.isdir(addon_path): - shutil.rmtree(addon_path) - os.makedirs(addon_path) - - # Fake a call to cfx init - old_cwd = os.getcwd() - os.chdir(addon_path) - out, err = StringIO(), StringIO() - rc = initializer(None, ["init"], out, err) - os.chdir(old_cwd) - out, err = out.getvalue(), err.getvalue() - self.assertEqual(rc["result"], 0) - self.assertTrue("Have fun!" in out) - self.assertEqual(err,"") - - # run cfx test - rc, out, err = self.run_cfx(addon_path, ["test"]) - self.assertEqual(rc, 0) - self.assertIn("6 of 6 tests passed.", err) - self.assertIn("Program terminated successfully.", err) - - -if __name__ == "__main__": - unittest.main() diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/test_licenses.py b/addon-sdk/source/python-lib/cuddlefish/tests/test_licenses.py deleted file mode 100644 index 574812ada..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/test_licenses.py +++ /dev/null @@ -1,100 +0,0 @@ - -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -import unittest -import os.path - -parent = os.path.dirname -test_dir = parent(os.path.abspath(__file__)) -sdk_root = parent(parent(parent(test_dir))) - -def from_sdk_top(fn): - return os.path.abspath(os.path.join(sdk_root, fn)) - -MPL2_URL = "http://mozilla.org/MPL/2.0/" - -# These files all come with their own license headers -skip = [ - "python-lib/cuddlefish/_version.py", # generated, public domain - "doc/static-files/js/jquery.js", # MIT/GPL dual - "examples/annotator/data/jquery-1.4.2.min.js", # MIT/GPL dual - "examples/reddit-panel/data/jquery-1.4.4.min.js", # MIT/GPL dual - "examples/library-detector/data/library-detector.js", # MIT - "python-lib/mozrunner/killableprocess.py", # MIT? BSDish? - "python-lib/mozrunner/winprocess.py", # MIT - "packages/api-utils/tests/test-querystring.js", # MIT - "packages/api-utils/lib/promise.js", # MIT - "packages/api-utils/tests/test-promise.js", # MIT - "examples/actor-repl/README.md", # It's damn readme file - "examples/actor-repl/data/codemirror-compressed.js", # MIT - "examples/actor-repl/data/codemirror.css", # MIT - ] -absskip = [from_sdk_top(os.path.join(*fn.split("/"))) for fn in skip] - -class Licenses(unittest.TestCase): - def test(self): - # Examine most SDK files to check if they've got an MPL2 license - # header. We exclude some files that are known to include different - # licenses. - self.missing = [] - self.scan_file(from_sdk_top(os.path.join("python-lib", "jetpack_sdk_env.py"))) - self.scan(os.path.join("python-lib", "cuddlefish"), [".js", ".py"], - skipdirs=["sdk-docs"], # test_generate.py makes this - ) - self.scan(os.path.join("python-lib", "mozrunner"), [".py"]) - self.scan("lib", [".js", ".jsm", ".css"], - skipdirs=[ - "diffpatcher", # MIT - "method", # MIT - "child_process", # MPL 1.1/GPL 2.0/LGPL 2.1 - "fs" # MIT - ]) - self.scan("test", [".js", ".jsm", ".css", ".html"], - skipdirs=[ - "buffers", # MIT - "querystring", # MIT - "path" # MIT - ]) - self.scan("modules", [".js", ".jsm"]) - self.scan("examples", [".js", ".css", ".html", ".md"]) - self.scan("bin", [".bat", ".ps1", ".js"]) - for fn in [os.path.join("bin", "activate"), - os.path.join("bin", "cfx"), - os.path.join("bin", "integration-scripts", "buildbot-run-cfx-helper"), - os.path.join("bin", "integration-scripts", "integration-check"), - ]: - self.scan_file(from_sdk_top(fn)) - - if self.missing: - print - print "The following files are missing an MPL2 header:" - for fn in sorted(self.missing): - print " "+fn - self.fail("%d files are missing an MPL2 header" % len(self.missing)) - - def scan(self, start, extensions=[], skipdirs=[]): - # scan a whole subdirectory - start = from_sdk_top(start) - for root, dirs, files in os.walk(start): - for d in skipdirs: - if d in dirs: - dirs.remove(d) - for fn in files: - ext = os.path.splitext(fn)[1] - if extensions and ext not in extensions: - continue - absfn = os.path.join(root, fn) - if absfn in absskip: - continue - self.scan_file(absfn) - - def scan_file(self, fn): - # scan a single file - if not MPL2_URL in open(fn, "r").read(): - relfile = fn[len(sdk_root)+1:] - self.missing.append(relfile) - -if __name__ == '__main__': - unittest.main() diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/test_linker.py b/addon-sdk/source/python-lib/cuddlefish/tests/test_linker.py deleted file mode 100755 index 7a6fd12e4..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/test_linker.py +++ /dev/null @@ -1,247 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -import os.path -import shutil -import zipfile -from StringIO import StringIO -import simplejson as json -import unittest -import cuddlefish -from cuddlefish import packaging, manifest - -def up(path, generations=1): - for i in range(generations): - path = os.path.dirname(path) - return path - -ROOT = up(os.path.abspath(__file__), 4) -def get_linker_files_dir(name): - return os.path.join(up(os.path.abspath(__file__)), "linker-files", name) - -class Basic(unittest.TestCase): - def get_pkg(self, name): - d = get_linker_files_dir(name) - return packaging.get_config_in_dir(d) - - def test_deps(self): - target_cfg = self.get_pkg("one") - pkg_cfg = packaging.build_config(ROOT, target_cfg) - deps = packaging.get_deps_for_targets(pkg_cfg, ["one"]) - self.failUnlessEqual(deps, ["one"]) - deps = packaging.get_deps_for_targets(pkg_cfg, - [target_cfg.name, "addon-sdk"]) - self.failUnlessEqual(deps, ["addon-sdk", "one"]) - - def test_manifest(self): - target_cfg = self.get_pkg("one") - pkg_cfg = packaging.build_config(ROOT, target_cfg) - deps = packaging.get_deps_for_targets(pkg_cfg, - [target_cfg.name, "addon-sdk"]) - self.failUnlessEqual(deps, ["addon-sdk", "one"]) - # target_cfg.dependencies is not provided, so we'll search through - # all known packages (everything in 'deps'). - m = manifest.build_manifest(target_cfg, pkg_cfg, deps, scan_tests=False) - m = m.get_harness_options_manifest(False) - - def assertReqIs(modname, reqname, path): - reqs = m["one/%s" % modname]["requirements"] - self.failUnlessEqual(reqs[reqname], path) - - assertReqIs("main", "sdk/panel", "sdk/panel") - assertReqIs("main", "two.js", "one/two") - assertReqIs("main", "./two", "one/two") - assertReqIs("main", "sdk/tabs.js", "sdk/tabs") - assertReqIs("main", "./subdir/three", "one/subdir/three") - assertReqIs("two", "main", "one/main") - assertReqIs("subdir/three", "../main", "one/main") - - target_cfg.dependencies = [] - - try: - # this should now work, as we ignore missing modules by default - m = manifest.build_manifest(target_cfg, pkg_cfg, deps, scan_tests=False) - m = m.get_harness_options_manifest(False) - - assertReqIs("main", "sdk/panel", "sdk/panel") - # note that with "addon-sdk" dependency present, - # "sdk/tabs.js" mapped to "sdk/tabs", but without, - # we just get the default (identity) mapping - assertReqIs("main", "sdk/tabs.js", "sdk/tabs.js") - except Exception, e: - self.fail("Must not throw from build_manifest() if modules are missing") - - # now, because .dependencies *is* provided, we won't search 'deps', - # and stop_on_missing is True, we'll get a link error - self.assertRaises(manifest.ModuleNotFoundError, - manifest.build_manifest, - target_cfg, pkg_cfg, deps, scan_tests=False, - abort_on_missing=True) - - def test_main_in_deps(self): - target_cfg = self.get_pkg("three") - package_path = [get_linker_files_dir("three-deps")] - pkg_cfg = packaging.build_config(ROOT, target_cfg, - packagepath=package_path) - deps = packaging.get_deps_for_targets(pkg_cfg, - [target_cfg.name, "addon-sdk"]) - self.failUnlessEqual(deps, ["addon-sdk", "three"]) - m = manifest.build_manifest(target_cfg, pkg_cfg, deps, scan_tests=False) - m = m.get_harness_options_manifest(False) - def assertReqIs(modname, reqname, path): - reqs = m["three/%s" % modname]["requirements"] - self.failUnlessEqual(reqs[reqname], path) - assertReqIs("main", "three-a", "three-a/main") - assertReqIs("main", "three-b", "three-b/main") - assertReqIs("main", "three-c", "three-c/main") - - def test_relative_main_in_top(self): - target_cfg = self.get_pkg("five") - package_path = [] - pkg_cfg = packaging.build_config(ROOT, target_cfg, - packagepath=package_path) - deps = packaging.get_deps_for_targets(pkg_cfg, - [target_cfg.name, "addon-sdk"]) - self.failUnlessEqual(deps, ["addon-sdk", "five"]) - # all we care about is that this next call doesn't raise an exception - m = manifest.build_manifest(target_cfg, pkg_cfg, deps, scan_tests=False) - m = m.get_harness_options_manifest(False) - reqs = m["five/main"]["requirements"] - self.failUnlessEqual(reqs, {}); - - def test_unreachable_relative_main_in_top(self): - target_cfg = self.get_pkg("six") - package_path = [] - pkg_cfg = packaging.build_config(ROOT, target_cfg, - packagepath=package_path) - deps = packaging.get_deps_for_targets(pkg_cfg, - [target_cfg.name, "addon-sdk"]) - self.failUnlessEqual(deps, ["addon-sdk", "six"]) - self.assertRaises(manifest.UnreachablePrefixError, - manifest.build_manifest, - target_cfg, pkg_cfg, deps, scan_tests=False) - - def test_unreachable_in_deps(self): - target_cfg = self.get_pkg("four") - package_path = [get_linker_files_dir("four-deps")] - pkg_cfg = packaging.build_config(ROOT, target_cfg, - packagepath=package_path) - deps = packaging.get_deps_for_targets(pkg_cfg, - [target_cfg.name, "addon-sdk"]) - self.failUnlessEqual(deps, ["addon-sdk", "four"]) - self.assertRaises(manifest.UnreachablePrefixError, - manifest.build_manifest, - target_cfg, pkg_cfg, deps, scan_tests=False) - -class Contents(unittest.TestCase): - - def run_in_subdir(self, dirname, f, *args, **kwargs): - top = os.path.abspath(os.getcwd()) - basedir = os.path.abspath(os.path.join(".test_tmp",self.id(),dirname)) - if os.path.isdir(basedir): - assert basedir.startswith(top) - shutil.rmtree(basedir) - os.makedirs(basedir) - try: - os.chdir(basedir) - return f(basedir, *args, **kwargs) - finally: - os.chdir(top) - - def assertIn(self, what, inside_what): - self.failUnless(what in inside_what, inside_what) - - def test_jetpackID(self): - # this uses "id": "jid7", to which a @jetpack should be appended - seven = get_linker_files_dir("seven") - def _test(basedir): - stdout = StringIO() - shutil.copytree(seven, "seven") - os.chdir("seven") - try: - # regrettably, run() always finishes with sys.exit() - cuddlefish.run(["xpi", "--no-strip-xpi"], - stdout=stdout) - except SystemExit, e: - self.failUnlessEqual(e.args[0], 0) - zf = zipfile.ZipFile("seven.xpi", "r") - hopts = json.loads(zf.read("harness-options.json")) - self.failUnlessEqual(hopts["jetpackID"], "jid7@jetpack") - self.run_in_subdir("x", _test) - - def test_jetpackID_suffix(self): - # this uses "id": "jid1@jetpack", so no suffix should be appended - one = get_linker_files_dir("one") - def _test(basedir): - stdout = StringIO() - shutil.copytree(one, "one") - os.chdir("one") - try: - # regrettably, run() always finishes with sys.exit() - cuddlefish.run(["xpi", "--no-strip-xpi"], - stdout=stdout) - except SystemExit, e: - self.failUnlessEqual(e.args[0], 0) - zf = zipfile.ZipFile("one.xpi", "r") - hopts = json.loads(zf.read("harness-options.json")) - self.failUnlessEqual(hopts["jetpackID"], "jid1@jetpack") - self.run_in_subdir("x", _test) - - def test_strip_default(self): - seven = get_linker_files_dir("seven") - # now run 'cfx xpi' in that directory, except put the generated .xpi - # elsewhere - def _test(basedir): - stdout = StringIO() - shutil.copytree(seven, "seven") - os.chdir("seven") - try: - # regrettably, run() always finishes with sys.exit() - cuddlefish.run(["xpi"], # --strip-xpi is now the default - stdout=stdout) - except SystemExit, e: - self.failUnlessEqual(e.args[0], 0) - zf = zipfile.ZipFile("seven.xpi", "r") - names = zf.namelist() - # problem found in bug 664840 was that an addon - # without an explicit tests/ directory would copy all files from - # the package into a bogus JID-PKGNAME-tests/ directory, so check - # for that - testfiles = [fn for fn in names if "seven/tests" in fn] - self.failUnlessEqual([], testfiles) - # another problem was that data files were being stripped from - # the XPI. Note that data/ is only supposed to be included if a - # module that actually gets used does a require("self") . - self.assertIn("resources/seven/data/text.data", - names) - self.failIf("seven/lib/unused.js" - in names, names) - self.run_in_subdir("x", _test) - - def test_no_strip(self): - seven = get_linker_files_dir("seven") - def _test(basedir): - stdout = StringIO() - shutil.copytree(seven, "seven") - os.chdir("seven") - try: - # regrettably, run() always finishes with sys.exit() - cuddlefish.run(["xpi", "--no-strip-xpi"], - stdout=stdout) - except SystemExit, e: - self.failUnlessEqual(e.args[0], 0) - zf = zipfile.ZipFile("seven.xpi", "r") - names = zf.namelist() - self.assertIn("resources/addon-sdk/lib/sdk/loader/cuddlefish.js", names) - testfiles = [fn for fn in names if "seven/tests" in fn] - self.failUnlessEqual([], testfiles) - self.assertIn("resources/seven/data/text.data", - names) - self.failUnless("resources/seven/lib/unused.js" - in names, names) - self.run_in_subdir("x", _test) - - -if __name__ == '__main__': - unittest.main() diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/test_manifest.py b/addon-sdk/source/python-lib/cuddlefish/tests/test_manifest.py deleted file mode 100644 index 1bced1234..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/test_manifest.py +++ /dev/null @@ -1,257 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - - -import unittest -from StringIO import StringIO -from cuddlefish.manifest import scan_module - -class Extra: - def failUnlessKeysAre(self, d, keys): - self.failUnlessEqual(sorted(d.keys()), sorted(keys)) - -class Require(unittest.TestCase, Extra): - def scan(self, text): - lines = StringIO(text).readlines() - requires, problems, locations = scan_module("fake.js", lines) - self.failUnlessEqual(problems, False) - return requires - - def scan_locations(self, text): - lines = StringIO(text).readlines() - requires, problems, locations = scan_module("fake.js", lines) - self.failUnlessEqual(problems, False) - return requires, locations - - def test_modules(self): - mod = """var foo = require('one');""" - requires = self.scan(mod) - self.failUnlessKeysAre(requires, ["one"]) - - mod = """var foo = require(\"one\");""" - requires = self.scan(mod) - self.failUnlessKeysAre(requires, ["one"]) - - mod = """var foo=require( 'one' ) ; """ - requires = self.scan(mod) - self.failUnlessKeysAre(requires, ["one"]) - - mod = """var foo = require('o'+'ne'); // tricky, denied""" - requires = self.scan(mod) - self.failUnlessKeysAre(requires, []) - - mod = """require('one').immediately.do().stuff();""" - requires, locations = self.scan_locations(mod) - self.failUnlessKeysAre(requires, ["one"]) - self.failUnlessEqual(locations, {"one": 1}) - - # these forms are commented out, and thus ignored - - mod = """// var foo = require('one');""" - requires = self.scan(mod) - self.failUnlessKeysAre(requires, []) - - mod = """/* var foo = require('one');""" - requires = self.scan(mod) - self.failUnlessKeysAre(requires, []) - - mod = """ * var foo = require('one');""" - requires = self.scan(mod) - self.failUnlessKeysAre(requires, []) - - mod = """ ' var foo = require('one');""" - requires = self.scan(mod) - self.failUnlessKeysAre(requires, ["one"]) - - mod = """ \" var foo = require('one');""" - requires = self.scan(mod) - self.failUnlessKeysAre(requires, ["one"]) - - # multiple requires - - mod = """const foo = require('one'); - const foo = require('two');""" - requires, locations = self.scan_locations(mod) - self.failUnlessKeysAre(requires, ["one", "two"]) - self.failUnlessEqual(locations["one"], 1) - self.failUnlessEqual(locations["two"], 2) - - mod = """const foo = require('repeated'); - const bar = require('repeated'); - const baz = require('repeated');""" - requires, locations = self.scan_locations(mod) - self.failUnlessKeysAre(requires, ["repeated"]) - self.failUnlessEqual(locations["repeated"], 1) # first occurrence - - mod = """const foo = require('one'); const foo = require('two');""" - requires = self.scan(mod) - self.failUnlessKeysAre(requires, ["one", "two"]) - - # define calls - - mod = """define('one', ['two', 'numbers/three'], function(t, th) {});""" - requires = self.scan(mod) - self.failUnlessKeysAre(requires, ["two", "numbers/three"]) - - mod = """define( - ['odd', - "numbers/four"], function() {});""" - requires = self.scan(mod) - self.failUnlessKeysAre(requires, ["odd", "numbers/four"]) - - mod = """define(function(require, exports, module) { - var a = require("some/module/a"), - b = require('b/v1'); - exports.a = a; - //This is a fakeout: require('bad'); - /* And another var bad = require('bad2'); */ - require('foo').goFoo(); - });""" - requires = self.scan(mod) - self.failUnlessKeysAre(requires, ["some/module/a", "b/v1", "foo"]) - - mod = """define ( - "foo", - ["bar"], function (bar) { - var me = require("me"); - } - )""" - requires = self.scan(mod) - self.failUnlessKeysAre(requires, ["bar", "me"]) - - mod = """define(['se' + 'ven', 'eight', nine], function () {});""" - requires = self.scan(mod) - self.failUnlessKeysAre(requires, ["eight"]) - - # async require calls - - mod = """require(['one'], function(one) {var o = require("one");});""" - requires = self.scan(mod) - self.failUnlessKeysAre(requires, ["one"]) - - mod = """require([ 'one' ], function(one) {var t = require("two");});""" - requires = self.scan(mod) - self.failUnlessKeysAre(requires, ["one", "two"]) - - mod = """require ( ['two', 'numbers/three'], function(t, th) {});""" - requires = self.scan(mod) - self.failUnlessKeysAre(requires, ["two", "numbers/three"]) - - mod = """require ( - ["bar", "fa" + 'ke' ], function (bar) { - var me = require("me"); - // require("bad").doBad(); - } - )""" - requires = self.scan(mod) - self.failUnlessKeysAre(requires, ["bar", "me"]) - -def scan2(text, fn="fake.js"): - stderr = StringIO() - lines = StringIO(text).readlines() - requires, problems, locations = scan_module(fn, lines, stderr) - stderr.seek(0) - return requires, problems, stderr.readlines() - -class Chrome(unittest.TestCase, Extra): - - def test_ignore_loader(self): - # we specifically ignore the loader itself - mod = """let {Cc,Ci} = require('chrome');""" - requires, problems, err = scan2(mod, "blah/cuddlefish.js") - self.failUnlessKeysAre(requires, ["chrome"]) - self.failUnlessEqual(problems, False) - self.failUnlessEqual(err, []) - - def test_chrome(self): - mod = """let {Cc,Ci} = require('chrome');""" - requires, problems, err = scan2(mod) - self.failUnlessKeysAre(requires, ["chrome"]) - self.failUnlessEqual(problems, False) - self.failUnlessEqual(err, []) - - mod = """var foo = require('foo'); - let {Cc,Ci} = require('chrome');""" - requires, problems, err = scan2(mod) - self.failUnlessKeysAre(requires, ["foo", "chrome"]) - self.failUnlessEqual(problems, False) - self.failUnlessEqual(err, []) - - mod = """let c = require('chrome');""" - requires, problems, err = scan2(mod) - self.failUnlessKeysAre(requires, ["chrome"]) - self.failUnlessEqual(problems, False) - self.failUnlessEqual(err, []) - - mod = """var foo = require('foo'); - let c = require('chrome');""" - requires, problems, err = scan2(mod) - self.failUnlessKeysAre(requires, ["foo", "chrome"]) - self.failUnlessEqual(problems, False) - self.failUnlessEqual(err, []) - - def test_not_chrome(self): - # from bug 596595 - mod = r'soughtLines: new RegExp("^\\s*(\\[[0-9 .]*\\])?\\s*\\(\\((EE|WW)\\)|.* [Cc]hipsets?: \\)|\\s*Backtrace")' - requires, problems, err = scan2(mod) - self.failUnlessKeysAre(requires, []) - self.failUnlessEqual((problems,err), (False, [])) - - def test_not_chrome2(self): - # from bug 655788 - mod = r"var foo = 'some stuff Cr';" - requires, problems, err = scan2(mod) - self.failUnlessKeysAre(requires, []) - self.failUnlessEqual((problems,err), (False, [])) - -class BadChrome(unittest.TestCase, Extra): - def test_bad_alias(self): - # using Components.* gets you an error, with a message that teaches - # you the correct approach. - mod = """let Cc = Components.classes; - let Cu = Components.utils; - """ - requires, problems, err = scan2(mod) - self.failUnlessKeysAre(requires, []) - self.failUnlessEqual(problems, True) - self.failUnlessEqual(err[1], "The following lines from file fake.js:\n") - self.failUnlessEqual(err[2], " 1: let Cc = Components.classes;\n") - self.failUnlessEqual(err[3], " 2: let Cu = Components.utils;\n") - self.failUnlessEqual(err[4], "use 'Components' to access chrome authority. To do so, you need to add a\n") - self.failUnlessEqual(err[5], "line somewhat like the following:\n") - self.failUnlessEqual(err[7], ' const {Cc,Cu} = require("chrome");\n') - self.failUnlessEqual(err[9], "Then you can use any shortcuts to its properties that you import from the\n") - - def test_bad_misc(self): - # If it looks like you're using something that doesn't have an alias, - # the warning also suggests a better way. - mod = """if (Components.isSuccessCode(foo)) - """ - requires, problems, err = scan2(mod) - self.failUnlessKeysAre(requires, []) - self.failUnlessEqual(problems, True) - self.failUnlessEqual(err[1], "The following lines from file fake.js:\n") - self.failUnlessEqual(err[2], " 1: if (Components.isSuccessCode(foo))\n") - self.failUnlessEqual(err[3], "use 'Components' to access chrome authority. To do so, you need to add a\n") - self.failUnlessEqual(err[4], "line somewhat like the following:\n") - self.failUnlessEqual(err[6], ' const {components} = require("chrome");\n') - self.failUnlessEqual(err[8], "Then you can use any shortcuts to its properties that you import from the\n") - - def test_chrome_components(self): - # Bug 636145/774636: We no longer tolerate usages of "Components", - # even when adding `require("chrome")` to your module. - mod = """require("chrome"); - var ios = Components.classes['@mozilla.org/network/io-service;1'];""" - requires, problems, err = scan2(mod) - self.failUnlessKeysAre(requires, ["chrome"]) - self.failUnlessEqual(problems, True) - self.failUnlessEqual(err[1], "The following lines from file fake.js:\n") - self.failUnlessEqual(err[2], " 2: var ios = Components.classes['@mozilla.org/network/io-service;1'];\n") - self.failUnlessEqual(err[3], "use 'Components' to access chrome authority. To do so, you need to add a\n") - self.failUnlessEqual(err[4], "line somewhat like the following:\n") - self.failUnlessEqual(err[6], ' const {Cc} = require("chrome");\n') - self.failUnlessEqual(err[8], "Then you can use any shortcuts to its properties that you import from the\n") - -if __name__ == '__main__': - unittest.main() diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/test_packaging.py b/addon-sdk/source/python-lib/cuddlefish/tests/test_packaging.py deleted file mode 100644 index 6944dc394..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/test_packaging.py +++ /dev/null @@ -1,117 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -import os -import unittest - -from cuddlefish import packaging -from cuddlefish.bunch import Bunch - -tests_path = os.path.abspath(os.path.dirname(__file__)) -static_files_path = os.path.join(tests_path, 'static-files') - -def get_configs(pkg_name, dirname='static-files'): - root_path = os.path.join(tests_path, dirname) - pkg_path = os.path.join(root_path, 'packages', pkg_name) - if not (os.path.exists(pkg_path) and os.path.isdir(pkg_path)): - raise Exception('path does not exist: %s' % pkg_path) - target_cfg = packaging.get_config_in_dir(pkg_path) - pkg_cfg = packaging.build_config(root_path, target_cfg) - deps = packaging.get_deps_for_targets(pkg_cfg, [pkg_name]) - build = packaging.generate_build_for_target( - pkg_cfg=pkg_cfg, - target=pkg_name, - deps=deps, - is_running_tests=True, - ) - return Bunch(target_cfg=target_cfg, pkg_cfg=pkg_cfg, build=build) - -class PackagingTests(unittest.TestCase): - def test_bug_588661(self): - configs = get_configs('foo', 'bug-588661-files') - self.assertEqual(configs.build.loader, - 'foo/lib/foo-loader.js') - - def test_bug_614712(self): - configs = get_configs('commonjs-naming', 'bug-614712-files') - packages = configs.pkg_cfg.packages - base = os.path.join(tests_path, 'bug-614712-files', 'packages') - self.assertEqual(packages['original-naming'].tests, - [os.path.join(base, 'original-naming', 'tests')]) - self.assertEqual(packages['commonjs-naming'].tests, - [os.path.join(base, 'commonjs-naming', 'test')]) - - def test_basic(self): - configs = get_configs('aardvark') - packages = configs.pkg_cfg.packages - - self.assertTrue('addon-sdk' in packages) - self.assertTrue('aardvark' in packages) - self.assertTrue('addon-sdk' in packages.aardvark.dependencies) - self.assertEqual(packages['addon-sdk'].loader, 'lib/sdk/loader/cuddlefish.js') - self.assertTrue(packages.aardvark.main == 'main') - self.assertTrue(packages.aardvark.version == "1.0") - -class PackagePath(unittest.TestCase): - def test_packagepath(self): - root_path = os.path.join(tests_path, 'static-files') - pkg_path = os.path.join(root_path, 'packages', 'minimal') - target_cfg = packaging.get_config_in_dir(pkg_path) - pkg_cfg = packaging.build_config(root_path, target_cfg) - base_packages = set(pkg_cfg.packages.keys()) - ppath = [os.path.join(tests_path, 'bug-611495-files')] - pkg_cfg2 = packaging.build_config(root_path, target_cfg, packagepath=ppath) - all_packages = set(pkg_cfg2.packages.keys()) - self.assertEqual(sorted(["jspath-one"]), - sorted(all_packages - base_packages)) - -class Directories(unittest.TestCase): - # for bug 652227 - packages_path = os.path.join(tests_path, "bug-652227-files", "packages") - def get_config(self, pkg_name): - pkg_path = os.path.join(tests_path, "bug-652227-files", "packages", - pkg_name) - return packaging.get_config_in_dir(pkg_path) - - def test_explicit_lib(self): - # package.json provides .lib - p = self.get_config('explicit-lib') - self.assertEqual(os.path.abspath(p.lib[0]), - os.path.abspath(os.path.join(self.packages_path, - "explicit-lib", - "alt2-lib"))) - - def test_directories_lib(self): - # package.json provides .directories.lib - p = self.get_config('explicit-dir-lib') - self.assertEqual(os.path.abspath(p.lib[0]), - os.path.abspath(os.path.join(self.packages_path, - "explicit-dir-lib", - "alt-lib"))) - - def test_lib(self): - # package.json is empty, but lib/ exists - p = self.get_config("default-lib") - self.assertEqual(os.path.abspath(p.lib[0]), - os.path.abspath(os.path.join(self.packages_path, - "default-lib", - "lib"))) - - def test_root(self): - # package.json is empty, no lib/, so files are in root - p = self.get_config('default-root') - self.assertEqual(os.path.abspath(p.lib[0]), - os.path.abspath(os.path.join(self.packages_path, - "default-root"))) - - def test_locale(self): - # package.json is empty, but locale/ exists and should be used - p = self.get_config("default-locale") - self.assertEqual(os.path.abspath(p.locale), - os.path.abspath(os.path.join(self.packages_path, - "default-locale", - "locale"))) - -if __name__ == "__main__": - unittest.main() diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/test_preflight.py b/addon-sdk/source/python-lib/cuddlefish/tests/test_preflight.py deleted file mode 100644 index 571b7911b..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/test_preflight.py +++ /dev/null @@ -1,147 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - - -import os, shutil -import simplejson as json -import unittest -import hashlib -import base64 -from cuddlefish import preflight -from StringIO import StringIO - -class Util(unittest.TestCase): - def get_basedir(self): - return os.path.join(".test_tmp", self.id()) - def make_basedir(self): - basedir = self.get_basedir() - if os.path.isdir(basedir): - here = os.path.abspath(os.getcwd()) - assert os.path.abspath(basedir).startswith(here) # safety - shutil.rmtree(basedir) - os.makedirs(basedir) - return basedir - - def test_base62(self): - for i in range(1000): - h = hashlib.sha1(str(i)).digest() - s1 = base64.b64encode(h, "AB").strip("=") - s2 = base64.b64encode(h).strip("=").replace("+","A").replace("/","B") - self.failUnlessEqual(s1, s2) - - def write(self, config): - basedir = self.get_basedir() - fn = os.path.join(basedir, "package.json") - open(fn,"w").write(config) - def read(self): - basedir = self.get_basedir() - fn = os.path.join(basedir, "package.json") - return open(fn,"r").read() - - def get_cfg(self): - cfg = json.loads(self.read()) - if "name" not in cfg: - # the cfx parser always provides a name, even if package.json - # doesn't contain one - cfg["name"] = "pretend name" - return cfg - - def parse(self, keydata): - fields = {} - fieldnames = [] - for line in keydata.split("\n"): - if line.strip(): - k,v = line.split(":", 1) - k = k.strip() ; v = v.strip() - fields[k] = v - fieldnames.append(k) - return fields, fieldnames - - def test_preflight(self): - basedir = self.make_basedir() - fn = os.path.join(basedir, "package.json") - - # empty config is not ok: need id (name is automatically supplied) - config_orig = "{}" - self.write(config_orig) - out = StringIO() - cfg = self.get_cfg() - config_was_ok, modified = preflight.preflight_config(cfg, fn, - stderr=out) - self.failUnlessEqual(config_was_ok, False) - self.failUnlessEqual(modified, True) - backup_fn = os.path.join(basedir, "package.json.backup") - config_backup = open(backup_fn,"r").read() - self.failUnlessEqual(config_backup, config_orig) - config = json.loads(self.read()) - self.failIf("name" in config) - self.failUnless("id" in config) - self.failUnless(config["id"].startswith("jid1-"), config["id"]) - self.failUnlessEqual(out.getvalue().strip(), - "No 'id' in package.json: creating a new ID for you.") - os.unlink(backup_fn) - - # just a name? we add the id - config_orig = '{"name": "my-awesome-package"}' - self.write(config_orig) - out = StringIO() - cfg = self.get_cfg() - config_was_ok, modified = preflight.preflight_config(cfg, fn, - stderr=out) - self.failUnlessEqual(config_was_ok, False) - self.failUnlessEqual(modified, True) - backup_fn = os.path.join(basedir, "package.json.backup") - config_backup = open(backup_fn,"r").read() - self.failUnlessEqual(config_backup, config_orig) - config = json.loads(self.read()) - self.failUnlessEqual(config["name"], "my-awesome-package") - self.failUnless("id" in config) - self.failUnless(config["id"].startswith("jid1-"), config["id"]) - jid = str(config["id"]) - self.failUnlessEqual(out.getvalue().strip(), - "No 'id' in package.json: creating a new ID for you.") - os.unlink(backup_fn) - - # name and valid id? great! ship it! - config2 = '{"name": "my-awesome-package", "id": "%s"}' % jid - self.write(config2) - out = StringIO() - cfg = self.get_cfg() - config_was_ok, modified = preflight.preflight_config(cfg, fn, - stderr=out) - self.failUnlessEqual(config_was_ok, True) - self.failUnlessEqual(modified, False) - config2a = self.read() - self.failUnlessEqual(config2a, config2) - self.failUnlessEqual(out.getvalue().strip(), "") - - # name and anonymous ID? without asking to see its papers, ship it - config3 = '{"name": "my-old-skool-package", "id": "anonid0-deadbeef"}' - self.write(config3) - out = StringIO() - cfg = self.get_cfg() - config_was_ok, modified = preflight.preflight_config(cfg, fn, - stderr=out) - self.failUnlessEqual(config_was_ok, True) - self.failUnlessEqual(modified, False) - config3a = self.read() - self.failUnlessEqual(config3a, config3) - self.failUnlessEqual(out.getvalue().strip(), "") - - # name and old-style ID? with nostalgic trepidation, ship it - config4 = '{"name": "my-old-skool-package", "id": "foo@bar.baz"}' - self.write(config4) - out = StringIO() - cfg = self.get_cfg() - config_was_ok, modified = preflight.preflight_config(cfg, fn, - stderr=out) - self.failUnlessEqual(config_was_ok, True) - self.failUnlessEqual(modified, False) - config4a = self.read() - self.failUnlessEqual(config4a, config4) - self.failUnlessEqual(out.getvalue().strip(), "") - - -if __name__ == '__main__': - unittest.main() diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/test_property_parser.py b/addon-sdk/source/python-lib/cuddlefish/tests/test_property_parser.py deleted file mode 100644 index 4988f8ef5..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/test_property_parser.py +++ /dev/null @@ -1,93 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -import unittest - -from cuddlefish.property_parser import parse, MalformedLocaleFileError - -class TestParser(unittest.TestCase): - - def test_parse(self): - lines = [ - # Comments are striped only if `#` is the first non-space character - "sharp=#can be in value", - "# comment", - "#key=value", - " # comment2", - - "keyWithNoValue=", - "valueWithSpaces= ", - "valueWithMultilineSpaces= \\", - " \\", - " ", - - # All spaces before/after are striped - " key = value ", - "key2=value2", - # Keys can contain '%' - "%s key=%s value", - - # Accept empty lines - "", - " ", - - # Multiline string must use backslash at end of lines - "multi=line\\", "value", - # With multiline string, left spaces are stripped ... - "some= spaces\\", " are\\ ", " stripped ", - # ... but not right spaces, except the last line! - "but=not \\", "all of \\", " them ", - - # Explicit [other] plural definition - "explicitPlural[one] = one", - "explicitPlural[other] = other", - - # Implicit [other] plural definition - "implicitPlural[one] = one", - "implicitPlural = other", # This key is the [other] one - ] - # Ensure that all lines end with a `\n` - # And that strings are unicode ones (parser code relies on it) - lines = [unicode(l + "\n") for l in lines] - pairs = parse(lines) - expected = { - "sharp": "#can be in value", - - "key": "value", - "key2": "value2", - "%s key": "%s value", - - "keyWithNoValue": "", - "valueWithSpaces": "", - "valueWithMultilineSpaces": "", - - "multi": "linevalue", - "some": "spacesarestripped", - "but": "not all of them", - - "implicitPlural": { - "one": "one", - "other": "other" - }, - "explicitPlural": { - "one": "one", - "other": "other" - }, - } - self.assertEqual(pairs, expected) - - def test_exceptions(self): - self.failUnlessRaises(MalformedLocaleFileError, parse, - ["invalid line with no key value"]) - self.failUnlessRaises(MalformedLocaleFileError, parse, - ["plural[one]=plural with no [other] value"]) - self.failUnlessRaises(MalformedLocaleFileError, parse, - ["multiline with no last empty line=\\"]) - self.failUnlessRaises(MalformedLocaleFileError, parse, - ["=no key"]) - self.failUnlessRaises(MalformedLocaleFileError, parse, - [" =only spaces in key"]) - -if __name__ == "__main__": - unittest.main() diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/test_rdf.py b/addon-sdk/source/python-lib/cuddlefish/tests/test_rdf.py deleted file mode 100644 index 5d9254e4e..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/test_rdf.py +++ /dev/null @@ -1,54 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -import unittest -import xml.dom.minidom -import os.path - -from cuddlefish import rdf, packaging - -parent = os.path.dirname -test_dir = parent(os.path.abspath(__file__)) -template_dir = os.path.join(parent(test_dir), "../../app-extension") - -class RDFTests(unittest.TestCase): - def testBug567660(self): - obj = rdf.RDF() - data = u'\u2026'.encode('utf-8') - x = '<?xml version="1.0" encoding="utf-8"?><blah>%s</blah>' % data - obj.dom = xml.dom.minidom.parseString(x) - self.assertEqual(obj.dom.documentElement.firstChild.nodeValue, - u'\u2026') - self.assertEqual(str(obj).replace("\n",""), x.replace("\n","")) - - def failUnlessIn(self, substring, s, msg=""): - if substring not in s: - self.fail("(%s) substring '%s' not in string '%s'" - % (msg, substring, s)) - - def testUnpack(self): - basedir = os.path.join(test_dir, "bug-715340-files") - for n in ["pkg-1-pack", "pkg-2-unpack", "pkg-3-pack"]: - cfg = packaging.get_config_in_dir(os.path.join(basedir, n)) - m = rdf.gen_manifest(template_dir, cfg, jid="JID") - if n.endswith("-pack"): - # these ones should remain packed - self.failUnlessEqual(m.get("em:unpack"), "false") - self.failUnlessIn("<em:unpack>false</em:unpack>", str(m), n) - else: - # and these should be unpacked - self.failUnlessEqual(m.get("em:unpack"), "true") - self.failUnlessIn("<em:unpack>true</em:unpack>", str(m), n) - - def testTitle(self): - basedir = os.path.join(test_dir, 'bug-906359-files') - for n in ['title', 'fullName', 'none']: - cfg = packaging.get_config_in_dir(os.path.join(basedir, n)) - m = rdf.gen_manifest(template_dir, cfg, jid='JID') - self.failUnlessEqual(m.get('em:name'), 'a long ' + n) - self.failUnlessIn('<em:name>a long ' + n + '</em:name>', str(m), n) - - -if __name__ == '__main__': - unittest.main() diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/test_runner.py b/addon-sdk/source/python-lib/cuddlefish/tests/test_runner.py deleted file mode 100644 index 26583abd1..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/test_runner.py +++ /dev/null @@ -1,27 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - - -def xulrunner_app_runner_doctests(): - """ - >>> import sys - >>> from cuddlefish import runner - >>> runner.XulrunnerAppRunner(binary='foo') - Traceback (most recent call last): - ... - Exception: Binary path does not exist foo - - >>> runner.XulrunnerAppRunner(binary=sys.executable) - Traceback (most recent call last): - ... - ValueError: application.ini not found in cmdargs - - >>> runner.XulrunnerAppRunner(binary=sys.executable, - ... cmdargs=['application.ini']) - Traceback (most recent call last): - ... - ValueError: file does not exist: 'application.ini' - """ - - pass diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/test_util.py b/addon-sdk/source/python-lib/cuddlefish/tests/test_util.py deleted file mode 100644 index aa636a48c..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/test_util.py +++ /dev/null @@ -1,22 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - - -import unittest -from cuddlefish.manifest import filter_filenames, filter_dirnames - -class Filter(unittest.TestCase): - def test_filter_filenames(self): - names = ["foo", "bar.js", "image.png", - ".hidden", "foo~", ".foo.swp", "bar.js.swp"] - self.failUnlessEqual(sorted(filter_filenames(names)), - sorted(["foo", "bar.js", "image.png"])) - - def test_filter_dirnames(self): - names = ["subdir", "data", ".git", ".hg", ".svn", "defaults"] - self.failUnlessEqual(sorted(filter_dirnames(names)), - sorted(["subdir", "data", "defaults"])) - -if __name__ == '__main__': - unittest.main() diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/test_version.py b/addon-sdk/source/python-lib/cuddlefish/tests/test_version.py deleted file mode 100644 index 814c57c89..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/test_version.py +++ /dev/null @@ -1,28 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -import os -import unittest -import shutil - -from cuddlefish._version import get_versions - -class Version(unittest.TestCase): - def get_basedir(self): - return os.path.join(".test_tmp", self.id()) - def make_basedir(self): - basedir = self.get_basedir() - if os.path.isdir(basedir): - here = os.path.abspath(os.getcwd()) - assert os.path.abspath(basedir).startswith(here) # safety - shutil.rmtree(basedir) - os.makedirs(basedir) - return basedir - - def test_current_version(self): - # the SDK should be able to determine its own version. We don't care - # what it is, merely that it can be computed. - version = get_versions()["version"] - self.failUnless(isinstance(version, str), (version, type(version))) - self.failUnless(len(version) > 0, version) diff --git a/addon-sdk/source/python-lib/cuddlefish/tests/test_xpi.py b/addon-sdk/source/python-lib/cuddlefish/tests/test_xpi.py deleted file mode 100644 index bbefee3b2..000000000 --- a/addon-sdk/source/python-lib/cuddlefish/tests/test_xpi.py +++ /dev/null @@ -1,310 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -import os -import unittest -import zipfile -import pprint -import shutil - -import simplejson as json -from cuddlefish import xpi, packaging, manifest, buildJID -from cuddlefish.tests import test_packaging -from test_linker import up - -import xml.etree.ElementTree as ElementTree - -xpi_template_path = os.path.join(test_packaging.static_files_path, - 'xpi-template') - -fake_manifest = '<RDF><!-- Extension metadata is here. --></RDF>' - - -class Bug588119Tests(unittest.TestCase): - def makexpi(self, pkg_name): - self.xpiname = "%s.xpi" % pkg_name - create_xpi(self.xpiname, pkg_name, 'bug-588119-files') - self.xpi = zipfile.ZipFile(self.xpiname, 'r') - options = self.xpi.read('harness-options.json') - self.xpi_harness_options = json.loads(options) - - def setUp(self): - self.xpiname = None - self.xpi = None - - def tearDown(self): - if self.xpi: - self.xpi.close() - if self.xpiname and os.path.exists(self.xpiname): - os.remove(self.xpiname) - - def testPackageWithImplicitIcon(self): - self.makexpi('implicit-icon') - assert 'icon.png' in self.xpi.namelist() - - def testPackageWithImplicitIcon64(self): - self.makexpi('implicit-icon') - assert 'icon64.png' in self.xpi.namelist() - - def testPackageWithExplicitIcon(self): - self.makexpi('explicit-icon') - assert 'icon.png' in self.xpi.namelist() - - def testPackageWithExplicitIcon64(self): - self.makexpi('explicit-icon') - assert 'icon64.png' in self.xpi.namelist() - - def testPackageWithNoIcon(self): - self.makexpi('no-icon') - assert 'icon.png' not in self.xpi.namelist() - - def testIconPathNotInHarnessOptions(self): - self.makexpi('implicit-icon') - assert 'icon' not in self.xpi_harness_options - - def testIcon64PathNotInHarnessOptions(self): - self.makexpi('implicit-icon') - assert 'icon64' not in self.xpi_harness_options - -class ExtraHarnessOptions(unittest.TestCase): - def setUp(self): - self.xpiname = None - self.xpi = None - - def tearDown(self): - if self.xpi: - self.xpi.close() - if self.xpiname and os.path.exists(self.xpiname): - os.remove(self.xpiname) - - def testOptions(self): - pkg_name = "extra-options" - self.xpiname = "%s.xpi" % pkg_name - create_xpi(self.xpiname, pkg_name, "bug-669274-files", - extra_harness_options={"builderVersion": "futuristic"}) - self.xpi = zipfile.ZipFile(self.xpiname, 'r') - options = self.xpi.read('harness-options.json') - hopts = json.loads(options) - self.failUnless("builderVersion" in hopts) - self.failUnlessEqual(hopts["builderVersion"], "futuristic") - - def testBadOptionName(self): - pkg_name = "extra-options" - self.xpiname = "%s.xpi" % pkg_name - self.failUnlessRaises(xpi.HarnessOptionAlreadyDefinedError, - create_xpi, - self.xpiname, pkg_name, "bug-669274-files", - extra_harness_options={"main": "already in use"}) - -class SmallXPI(unittest.TestCase): - def setUp(self): - self.root = up(os.path.abspath(__file__), 4) - def get_linker_files_dir(self, name): - return os.path.join(up(os.path.abspath(__file__)), "linker-files", name) - def get_pkg(self, name): - d = self.get_linker_files_dir(name) - return packaging.get_config_in_dir(d) - - def get_basedir(self): - return os.path.join(".test_tmp", self.id()) - def make_basedir(self): - basedir = self.get_basedir() - if os.path.isdir(basedir): - here = os.path.abspath(os.getcwd()) - assert os.path.abspath(basedir).startswith(here) # safety - shutil.rmtree(basedir) - os.makedirs(basedir) - return basedir - - def test_contents(self): - target_cfg = self.get_pkg("three") - package_path = [self.get_linker_files_dir("three-deps")] - pkg_cfg = packaging.build_config(self.root, target_cfg, - packagepath=package_path) - deps = packaging.get_deps_for_targets(pkg_cfg, - [target_cfg.name, "addon-sdk"]) - addon_sdk_dir = pkg_cfg.packages["addon-sdk"].lib[0] - m = manifest.build_manifest(target_cfg, pkg_cfg, deps, scan_tests=False) - used_files = list(m.get_used_files(True)) - here = up(os.path.abspath(__file__)) - def absify(*parts): - fn = os.path.join(here, "linker-files", *parts) - return os.path.abspath(fn) - expected = [absify(*parts) for parts in - [("three", "lib", "main.js"), - ("three-deps", "three-a", "lib", "main.js"), - ("three-deps", "three-a", "lib", "subdir", "subfile.js"), - ("three", "data", "msg.txt"), - ("three", "data", "subdir", "submsg.txt"), - ("three-deps", "three-b", "lib", "main.js"), - ("three-deps", "three-c", "lib", "main.js"), - ("three-deps", "three-c", "lib", "sub", "foo.js") - ]] - - add_addon_sdk= lambda path: os.path.join(addon_sdk_dir, path) - expected.extend([add_addon_sdk(module) for module in [ - os.path.join("sdk", "self.js"), - os.path.join("sdk", "core", "promise.js"), - os.path.join("sdk", "net", "url.js"), - os.path.join("sdk", "util", "object.js"), - os.path.join("sdk", "util", "array.js"), - os.path.join("sdk", "preferences", "service.js") - ]]) - - missing = set(expected) - set(used_files) - extra = set(used_files) - set(expected) - self.failUnlessEqual(list(missing), []) - self.failUnlessEqual(list(extra), []) - used_deps = m.get_used_packages() - - build = packaging.generate_build_for_target(pkg_cfg, target_cfg.name, - used_deps, - include_tests=False) - options = {'main': target_cfg.main} - options.update(build) - basedir = self.make_basedir() - xpi_name = os.path.join(basedir, "contents.xpi") - xpi.build_xpi(template_root_dir=xpi_template_path, - manifest=fake_manifest, - xpi_path=xpi_name, - harness_options=options, - limit_to=used_files) - x = zipfile.ZipFile(xpi_name, "r") - names = x.namelist() - expected = ["components/", - "components/harness.js", - # the real template also has 'bootstrap.js', but the fake - # one in tests/static-files/xpi-template doesn't - "harness-options.json", - "install.rdf", - "resources/", - "resources/addon-sdk/", - "resources/addon-sdk/lib/", - "resources/addon-sdk/lib/sdk/", - "resources/addon-sdk/lib/sdk/self.js", - "resources/addon-sdk/lib/sdk/core/", - "resources/addon-sdk/lib/sdk/util/", - "resources/addon-sdk/lib/sdk/net/", - "resources/addon-sdk/lib/sdk/core/promise.js", - "resources/addon-sdk/lib/sdk/util/object.js", - "resources/addon-sdk/lib/sdk/util/array.js", - "resources/addon-sdk/lib/sdk/net/url.js", - "resources/addon-sdk/lib/sdk/preferences/", - "resources/addon-sdk/lib/sdk/preferences/service.js", - "resources/three/", - "resources/three/lib/", - "resources/three/lib/main.js", - "resources/three/data/", - "resources/three/data/msg.txt", - "resources/three/data/subdir/", - "resources/three/data/subdir/submsg.txt", - "resources/three-a/", - "resources/three-a/lib/", - "resources/three-a/lib/main.js", - "resources/three-a/lib/subdir/", - "resources/three-a/lib/subdir/subfile.js", - "resources/three-b/", - "resources/three-b/lib/", - "resources/three-b/lib/main.js", - "resources/three-c/", - "resources/three-c/lib/", - "resources/three-c/lib/main.js", - "resources/three-c/lib/sub/", - "resources/three-c/lib/sub/foo.js", - # notably absent: three-a/lib/unused.js - "locale/", - "locale/fr-FR.json", - "locales.json", - ] - # showing deltas makes failures easier to investigate - missing = set(expected) - set(names) - extra = set(names) - set(expected) - self.failUnlessEqual((list(missing), list(extra)), ([], [])) - self.failUnlessEqual(sorted(names), sorted(expected)) - - # check locale files - localedata = json.loads(x.read("locales.json")) - self.failUnlessEqual(sorted(localedata["locales"]), sorted(["fr-FR"])) - content = x.read("locale/fr-FR.json") - locales = json.loads(content) - # Locale files are merged into one. - # Conflicts are silently resolved by taking last package translation, - # so that we get "No" translation from three-c instead of three-b one. - self.failUnlessEqual(locales, json.loads(u''' - { - "No": "Nein", - "one": "un", - "What?": "Quoi?", - "Yes": "Oui", - "plural": { - "other": "other", - "one": "one" - }, - "uft8_value": "\u00e9" - }''')) - - -def document_dir(name): - if name in ['packages', 'xpi-template']: - dirname = os.path.join(test_packaging.static_files_path, name) - document_dir_files(dirname) - elif name == 'xpi-output': - create_xpi('test-xpi.xpi') - document_zip_file('test-xpi.xpi') - os.remove('test-xpi.xpi') - else: - raise Exception('unknown dir: %s' % name) - -def normpath(path): - """ - Make a platform-specific relative path use '/' as a separator. - """ - - return path.replace(os.path.sep, '/') - -def document_zip_file(path): - zip = zipfile.ZipFile(path, 'r') - for name in sorted(zip.namelist()): - contents = zip.read(name) - lines = contents.splitlines() - if len(lines) == 1 and name.endswith('.json') and len(lines[0]) > 75: - # Ideally we would json-decode this, but it results - # in an annoying 'u' before every string literal, - # since json decoding makes all strings unicode. - contents = eval(contents) - contents = pprint.pformat(contents) - lines = contents.splitlines() - contents = "\n ".join(lines) - print "%s:\n %s" % (normpath(name), contents) - zip.close() - -def document_dir_files(path): - filename_contents_tuples = [] - for dirpath, dirnames, filenames in os.walk(path): - relpath = dirpath[len(path)+1:] - for filename in filenames: - abspath = os.path.join(dirpath, filename) - contents = open(abspath, 'r').read() - contents = "\n ".join(contents.splitlines()) - relfilename = os.path.join(relpath, filename) - filename_contents_tuples.append((normpath(relfilename), contents)) - filename_contents_tuples.sort() - for filename, contents in filename_contents_tuples: - print "%s:" % filename - print " %s" % contents - -def create_xpi(xpiname, pkg_name='aardvark', dirname='static-files', - extra_harness_options={}): - configs = test_packaging.get_configs(pkg_name, dirname) - options = {'main': configs.target_cfg.main, - 'jetpackID': buildJID(configs.target_cfg), } - options.update(configs.build) - xpi.build_xpi(template_root_dir=xpi_template_path, - manifest=fake_manifest, - xpi_path=xpiname, - harness_options=options, - extra_harness_options=extra_harness_options) - -if __name__ == '__main__': - unittest.main() |