summaryrefslogtreecommitdiffstats
path: root/addon-sdk/source/test/test-reference.js
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2018-02-09 06:46:43 -0500
committerMatt A. Tobin <email@mattatobin.com>2018-02-09 06:46:43 -0500
commitac46df8daea09899ce30dc8fd70986e258c746bf (patch)
tree2750d3125fc253fd5b0671e4bd268eff1fd97296 /addon-sdk/source/test/test-reference.js
parent8cecf8d5208f3945b35f879bba3015bb1a11bec6 (diff)
downloadUXP-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/test/test-reference.js')
-rw-r--r--addon-sdk/source/test/test-reference.js99
1 files changed, 0 insertions, 99 deletions
diff --git a/addon-sdk/source/test/test-reference.js b/addon-sdk/source/test/test-reference.js
deleted file mode 100644
index 1fe08004c..000000000
--- a/addon-sdk/source/test/test-reference.js
+++ /dev/null
@@ -1,99 +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/. */
-"use strict";
-
-const { isWeak, WeakReference } = require("sdk/core/reference");
-const { Class } = require("sdk/core/heritage");
-
-exports["test non WeakReferences"] = assert => {
- assert.equal(isWeak({}), false,
- "regular objects aren't weak");
-
- assert.equal(isWeak([]), false,
- "arrays aren't weak");
-};
-
-exports["test a WeakReference"] = assert => {
- assert.equal(isWeak(new WeakReference()), true,
- "instances of WeakReferences are weak");
-};
-
-exports["test a subclass"] = assert => {
- const SubType = Class({
- extends: WeakReference,
- foo: function() {
- }
- });
-
- const x = new SubType();
- assert.equal(isWeak(x), true,
- "subtypes of WeakReferences are weak");
-
- const SubSubType = Class({
- extends: SubType
- });
-
- const y = new SubSubType();
- assert.equal(isWeak(y), true,
- "sub subtypes of WeakReferences are weak");
-};
-
-exports["test a mixin"] = assert => {
- const Mixer = Class({
- implements: [WeakReference]
- });
-
- assert.equal(isWeak(new Mixer()), true,
- "instances with mixed WeakReference are weak");
-
- const Mux = Class({});
- const MixMux = Class({
- extends: Mux,
- implements: [WeakReference]
- });
-
- assert.equal(isWeak(new MixMux()), true,
- "instances with mixed WeakReference that " +
- "inheret from other are weak");
-
-
- const Base = Class({});
- const ReMix = Class({
- extends: Base,
- implements: [MixMux]
- });
-
- assert.equal(isWeak(new ReMix()), true,
- "subtime of mix is still weak");
-};
-
-exports["test an override"] = assert => {
- const SubType = Class({ extends: WeakReference });
- isWeak.define(SubType, x => false);
-
- assert.equal(isWeak(new SubType()), false,
- "behavior of isWeak can still be overrided on subtype");
-
- const Mixer = Class({ implements: [WeakReference] });
- const SubMixer = Class({ extends: Mixer });
- isWeak.define(SubMixer, x => false);
- assert.equal(isWeak(new SubMixer()), false,
- "behavior of isWeak can still be overrided on mixed type");
-};
-
-exports["test an opt-in"] = assert => {
- var BaseType = Class({});
- var SubType = Class({ extends: BaseType });
-
- isWeak.define(SubType, x => true);
- assert.equal(isWeak(new SubType()), true,
- "isWeak can be just implemented");
-
- var x = {};
- isWeak.implement(x, x => true);
- assert.equal(isWeak(x), true,
- "isWeak can be implemented per instance");
-};
-
-require("sdk/test").run(exports);