addon-sdk/source/test/test-system.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/addon-sdk/source/test/test-system.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,37 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +"use strict";
     1.8 +
     1.9 +const runtime = require("sdk/system/runtime");
    1.10 +const system = require("sdk/system");
    1.11 +
    1.12 +exports["test system architecture and compiler"] = function(assert) {
    1.13 +
    1.14 +  if (system.architecture !== null) {
    1.15 +    assert.equal(
    1.16 +      runtime.XPCOMABI.indexOf(system.architecture), 0,
    1.17 +      "system.architecture is starting substring of runtime.XPCOMABI"
    1.18 +    );
    1.19 +  }
    1.20 +
    1.21 +  if (system.compiler !== null) {
    1.22 +    assert.equal(
    1.23 +      runtime.XPCOMABI.indexOf(system.compiler),
    1.24 +      runtime.XPCOMABI.length - system.compiler.length,
    1.25 +      "system.compiler is trailing substring of runtime.XPCOMABI"
    1.26 +    );
    1.27 +  }
    1.28 +
    1.29 +  assert.ok(
    1.30 +    system.architecture === null || typeof(system.architecture) === "string",
    1.31 +    "system.architecture is string or null if not supported by platform"
    1.32 +  );
    1.33 +
    1.34 +  assert.ok(
    1.35 +    system.compiler === null || typeof(system.compiler) === "string",
    1.36 +    "system.compiler is string or null if not supported by platform"
    1.37 +  );
    1.38 +};
    1.39 +
    1.40 +require("test").run(exports);

mercurial