diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /devtools/client/sourceeditor/tern/tests | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'devtools/client/sourceeditor/tern/tests')
4 files changed, 53 insertions, 0 deletions
diff --git a/devtools/client/sourceeditor/tern/tests/unit/head_tern.js b/devtools/client/sourceeditor/tern/tests/unit/head_tern.js new file mode 100644 index 000000000..1ab102685 --- /dev/null +++ b/devtools/client/sourceeditor/tern/tests/unit/head_tern.js @@ -0,0 +1,3 @@ +"use strict"; +var { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components; +const { require } = Cu.import("resource://devtools/shared/Loader.jsm", {}); diff --git a/devtools/client/sourceeditor/tern/tests/unit/test_autocompletion.js b/devtools/client/sourceeditor/tern/tests/unit/test_autocompletion.js new file mode 100644 index 000000000..493d6fb18 --- /dev/null +++ b/devtools/client/sourceeditor/tern/tests/unit/test_autocompletion.js @@ -0,0 +1,26 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +/** + * Test that tern autocompletions work. + */ + +const tern = require("devtools/client/sourceeditor/tern/tern"); +const ecma5 = require("devtools/client/sourceeditor/tern/ecma5"); + +function run_test() { + do_test_pending(); + + const server = new tern.Server({ defs: [ecma5] }); + const code = "[]."; + const query = { type: "completions", file: "test", end: code.length }; + const files = [{ type: "full", name: "test", text: code }]; + + server.request({ query: query, files: files }, (error, response) => { + do_check_eq(error, null); + do_check_true(!!response); + do_check_true(Array.isArray(response.completions)); + do_check_true(response.completions.indexOf("concat") != -1); + do_test_finished(); + }); +} diff --git a/devtools/client/sourceeditor/tern/tests/unit/test_import_tern.js b/devtools/client/sourceeditor/tern/tests/unit/test_import_tern.js new file mode 100644 index 000000000..74f68fe60 --- /dev/null +++ b/devtools/client/sourceeditor/tern/tests/unit/test_import_tern.js @@ -0,0 +1,16 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +/** + * Test that we can require tern. + */ + +function run_test() { + const tern = require("devtools/client/sourceeditor/tern/tern"); + const ecma5 = require("devtools/client/sourceeditor/tern/ecma5"); + const browser = require("devtools/client/sourceeditor/tern/browser"); + do_check_true(!!tern); + do_check_true(!!ecma5); + do_check_true(!!browser); + do_check_eq(typeof tern.Server, "function"); +} diff --git a/devtools/client/sourceeditor/tern/tests/unit/xpcshell.ini b/devtools/client/sourceeditor/tern/tests/unit/xpcshell.ini new file mode 100644 index 000000000..567d8524d --- /dev/null +++ b/devtools/client/sourceeditor/tern/tests/unit/xpcshell.ini @@ -0,0 +1,8 @@ +[DEFAULT] +tags = devtools +head = head_tern.js +tail = +firefox-appdir = browser + +[test_autocompletion.js] +[test_import_tern.js] |