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 /addon-sdk/source/test/test-unit-test-finder.js | |
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 'addon-sdk/source/test/test-unit-test-finder.js')
-rw-r--r-- | addon-sdk/source/test/test-unit-test-finder.js | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/addon-sdk/source/test/test-unit-test-finder.js b/addon-sdk/source/test/test-unit-test-finder.js new file mode 100644 index 000000000..83db5c722 --- /dev/null +++ b/addon-sdk/source/test/test-unit-test-finder.js @@ -0,0 +1,57 @@ +/* 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 { makeFilters } = require("sdk/deprecated/unit-test-finder"); + +const testFiles = [ "test-clipboard", "test-timers" ] +const testMethods = [ "test set clipboard", "test setTimeout" ] + +exports["test makeFilters no options"] = (assert) => { + let { fileFilter, testFilter } = makeFilters(); + testFiles.forEach(f => assert.ok(fileFilter(f), "using no options on filename " + f + " works")); + testMethods.forEach(m => assert.ok(testFilter(m), "using no options on method name " + m + " works")); +} + +exports["test makeFilters no filter"] = (assert) => { + let { fileFilter, testFilter } = makeFilters({}); + testFiles.forEach(f => assert.ok(fileFilter(f), "using no options on filename " + f + " works")); + testMethods.forEach(m => assert.ok(testFilter(m), "using no options on method name " + m + " works")); +} + +exports["test makeFilters no method filter"] = (assert) => { + let { fileFilter, testFilter } = makeFilters({ filter: "i" }); + testFiles.forEach(f => assert.ok(fileFilter(f), "using filter 'i' on filename " + f + " works")); + testMethods.forEach(m => assert.ok(testFilter(m), "using filter 'i' on method name " + m + " works")); + + ({ fileFilter, testFilter } = makeFilters({ filter: "i:" })); + testFiles.forEach(f => assert.ok(fileFilter(f), "using filter 'i:' on filename " + f + " works")); + testMethods.forEach(m => assert.ok(testFilter(m), "using filter 'i:' on method name " + m + " works")); + + ({ fileFilter, testFilter } = makeFilters({ filter: "z:" })); + testFiles.forEach(f => assert.ok(!fileFilter(f), "using filter 'z:' on filename " + f + " dnw")); + testMethods.forEach(m => assert.ok(testFilter(m), "using filter 'z:' on method name " + m + " works")); +} + +exports["test makeFilters no file filter"] = (assert) => { + let { fileFilter, testFilter } = makeFilters({ filter: ":i" }); + testFiles.forEach(f => assert.ok(fileFilter(f), "using filter ':i' on filename " + f + " works")); + testMethods.forEach(m => assert.ok(testFilter(m), "using filter ':i' on method name " + m + " works")); + + ({ fileFilter, testFilter } = makeFilters({ filter: ":z" })); + testFiles.forEach(f => assert.ok(fileFilter(f), "using filter ':z' on filename " + f + " works")); + testMethods.forEach(m => assert.ok(!testFilter(m), "using filter ':z' on method name " + m + " dnw")); +} + +exports["test makeFilters both filters"] = (assert) => { + let { fileFilter, testFilter } = makeFilters({ filter: "i:i" }); + testFiles.forEach(f => assert.ok(fileFilter(f), "using filter 'i:i' on filename " + f + " works")); + testMethods.forEach(m => assert.ok(testFilter(m), "using filter 'i:i' on method name " + m + " works")); + + ({ fileFilter, testFilter } = makeFilters({ filter: "z:z" })); + testFiles.forEach(f => assert.ok(!fileFilter(f), "using filter 'z:z' on filename " + f + " dnw")); + testMethods.forEach(m => assert.ok(!testFilter(m), "using filter 'z:z' on method name " + m + " dnw")); +} + +require("sdk/test").run(exports); |