diff options
Diffstat (limited to 'addon-sdk/source/test/fixtures/native-addon-test')
13 files changed, 126 insertions, 0 deletions
diff --git a/addon-sdk/source/test/fixtures/native-addon-test/dir/a.js b/addon-sdk/source/test/fixtures/native-addon-test/dir/a.js new file mode 100644 index 000000000..2f8cccb68 --- /dev/null +++ b/addon-sdk/source/test/fixtures/native-addon-test/dir/a.js @@ -0,0 +1,5 @@ +/* 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/. */ + +module.exports = 'dir/a'; diff --git a/addon-sdk/source/test/fixtures/native-addon-test/dir/a/index.js b/addon-sdk/source/test/fixtures/native-addon-test/dir/a/index.js new file mode 100644 index 000000000..a86eaa184 --- /dev/null +++ b/addon-sdk/source/test/fixtures/native-addon-test/dir/a/index.js @@ -0,0 +1,5 @@ +/* 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/. */ + +module.exports = 'dir/a/index'; diff --git a/addon-sdk/source/test/fixtures/native-addon-test/dir/b.js b/addon-sdk/source/test/fixtures/native-addon-test/dir/b.js new file mode 100644 index 000000000..cd3e975b2 --- /dev/null +++ b/addon-sdk/source/test/fixtures/native-addon-test/dir/b.js @@ -0,0 +1,6 @@ +/* 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/. */ + +module.exports = require('test-math'); + diff --git a/addon-sdk/source/test/fixtures/native-addon-test/dir/c.js b/addon-sdk/source/test/fixtures/native-addon-test/dir/c.js new file mode 100644 index 000000000..ed5fd149e --- /dev/null +++ b/addon-sdk/source/test/fixtures/native-addon-test/dir/c.js @@ -0,0 +1,6 @@ +/* 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/. */ + +module.exports = require('../package.json'); + diff --git a/addon-sdk/source/test/fixtures/native-addon-test/dir/dummy.js b/addon-sdk/source/test/fixtures/native-addon-test/dir/dummy.js new file mode 100644 index 000000000..e1640884c --- /dev/null +++ b/addon-sdk/source/test/fixtures/native-addon-test/dir/dummy.js @@ -0,0 +1,6 @@ +/* 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/. */ + +module.exports = 'this is a dummy module'; + diff --git a/addon-sdk/source/test/fixtures/native-addon-test/dir/test.jsm b/addon-sdk/source/test/fixtures/native-addon-test/dir/test.jsm new file mode 100644 index 000000000..1e2946f94 --- /dev/null +++ b/addon-sdk/source/test/fixtures/native-addon-test/dir/test.jsm @@ -0,0 +1,6 @@ +/* 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['EXPORTED_SYMBOLS'] = ['test']; +test = 'this is a jsm'; diff --git a/addon-sdk/source/test/fixtures/native-addon-test/expectedmap.json b/addon-sdk/source/test/fixtures/native-addon-test/expectedmap.json new file mode 100644 index 000000000..4fa5886f7 --- /dev/null +++ b/addon-sdk/source/test/fixtures/native-addon-test/expectedmap.json @@ -0,0 +1,25 @@ +{ + "./index.js": { + "./dir/a": "./dir/a.js", + "./dir/b": "./dir/b.js", + "./dir/c": "./dir/c.js", + "./dir/dummy": "./dir/dummy.js", + "./dir/test.jsm": "./dir/test.jsm", + "./utils": "./utils/index.js", + "./newmodule": "./newmodule/lib/file.js", + "test-math": "./node_modules/test-math/index.js", + "test-custom-main": "./node_modules/test-custom-main/lib/custom-entry.js", + "test-custom-main-relative": "./node_modules/test-custom-main-relative/lib/custom-entry.js", + "test-default-main": "./node_modules/test-default-main/index.js" + }, + "./dir/b.js": { + "test-math": "./node_modules/test-math/index.js" + }, + "./dir/c.js": { + "../package.json": "./package.json" + }, + "./node_modules/test-math/index.js": { + "test-add": "./node_modules/test-math/node_modules/test-add/index.js", + "test-subtract": "./node_modules/test-math/node_modules/test-subtract/index.js" + } +} diff --git a/addon-sdk/source/test/fixtures/native-addon-test/index.js b/addon-sdk/source/test/fixtures/native-addon-test/index.js new file mode 100644 index 000000000..68720d401 --- /dev/null +++ b/addon-sdk/source/test/fixtures/native-addon-test/index.js @@ -0,0 +1,37 @@ +/* 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/. */ + +// Added noise to test AST walker +for (var i = 0; i < 5; i++) { + square(i); +} + +exports.directoryDefaults = require('./utils'); +exports.directoryMain = require('./newmodule'); +exports.resolvesJSoverDir= require('./dir/a'); +exports.math = require('test-math'); +exports.mathInRelative = require('./dir/b'); +exports.customMainModule = require('test-custom-main'); +exports.customMainModuleRelative = require('test-custom-main-relative'); +exports.defaultMain = require('test-default-main'); +exports.testJSON = require('./dir/c'); +exports.dummyModule = require('./dir/dummy'); + +exports.eventCore = require('sdk/event/core'); +exports.promise = require('sdk/core/promise'); + +exports.localJSM = require('./dir/test.jsm'); +exports.promisejsm = require('modules/Promise.jsm').Promise; +exports.require = require; + +var math = require('test-math'); +exports.areModulesCached = (math === exports.math); + +// Added noise to test AST walker +function square (x) { + let tmp = x; + tmp *= x; + return tmp; +} + diff --git a/addon-sdk/source/test/fixtures/native-addon-test/newmodule/index.js b/addon-sdk/source/test/fixtures/native-addon-test/newmodule/index.js new file mode 100644 index 000000000..f982e6b98 --- /dev/null +++ b/addon-sdk/source/test/fixtures/native-addon-test/newmodule/index.js @@ -0,0 +1,5 @@ +/* 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/. */ + +module.exports = 'index.js'; diff --git a/addon-sdk/source/test/fixtures/native-addon-test/newmodule/lib/file.js b/addon-sdk/source/test/fixtures/native-addon-test/newmodule/lib/file.js new file mode 100644 index 000000000..fab140983 --- /dev/null +++ b/addon-sdk/source/test/fixtures/native-addon-test/newmodule/lib/file.js @@ -0,0 +1,5 @@ +/* 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/. */ + +module.exports = 'main from new module'; diff --git a/addon-sdk/source/test/fixtures/native-addon-test/newmodule/package.json b/addon-sdk/source/test/fixtures/native-addon-test/newmodule/package.json new file mode 100644 index 000000000..feae8acaa --- /dev/null +++ b/addon-sdk/source/test/fixtures/native-addon-test/newmodule/package.json @@ -0,0 +1,3 @@ +{ + "main":"lib/file.js" +} diff --git a/addon-sdk/source/test/fixtures/native-addon-test/package.json b/addon-sdk/source/test/fixtures/native-addon-test/package.json new file mode 100644 index 000000000..f689b83f6 --- /dev/null +++ b/addon-sdk/source/test/fixtures/native-addon-test/package.json @@ -0,0 +1,10 @@ +{ + "main":"index.js", + "dependencies": { + "test-math": "*", + "test-custom-main": "*", + "test-custom-main-relative": "*", + "test-default-main": "*", + "test-assets": "*" + } +} diff --git a/addon-sdk/source/test/fixtures/native-addon-test/utils/index.js b/addon-sdk/source/test/fixtures/native-addon-test/utils/index.js new file mode 100644 index 000000000..d34af25d5 --- /dev/null +++ b/addon-sdk/source/test/fixtures/native-addon-test/utils/index.js @@ -0,0 +1,7 @@ +/* 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/. */ +"use strict"; + +module.exports = 'utils'; + |