123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240 |
- /*
- * Copyright 2012, Mozilla Foundation and contributors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- "use strict";
- // THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT
- // PLEASE TALK TO SOMEONE IN DEVELOPER TOOLS BEFORE EDITING IT
- const exports = {};
- function test() {
- helpers.runTestModule(exports, "browser_gcli_context.js");
- }
- // var helpers = require('./helpers');
- exports.testBaseline = function (options) {
- return helpers.audit(options, [
- // These 3 establish a baseline for comparison when we have used the
- // context command
- {
- setup: "ext",
- check: {
- input: "ext",
- hints: " -> context",
- markup: "III",
- message: "",
- predictions: [ "context", "tsn ext", "tsn exte", "tsn exten", "tsn extend" ],
- unassigned: [ ],
- }
- },
- {
- setup: "ext test",
- check: {
- input: "ext test",
- hints: "",
- markup: "IIIVEEEE",
- status: "ERROR",
- message: "Too many arguments",
- unassigned: [ " test" ],
- }
- },
- {
- setup: "tsn",
- check: {
- input: "tsn",
- hints: " deep down nested cmd",
- markup: "III",
- cursor: 3,
- current: "__command",
- status: "ERROR",
- predictionsContains: [ "tsn deep down nested cmd", "tsn ext", "tsn exte" ],
- args: {
- command: { name: "tsn" },
- }
- }
- }
- ]);
- };
- exports.testContext = function (options) {
- return helpers.audit(options, [
- // Use the 'tsn' context
- {
- setup: "context tsn",
- check: {
- input: "context tsn",
- hints: " deep down nested cmd",
- markup: "VVVVVVVVVVV",
- message: "",
- predictionsContains: [ "tsn deep down nested cmd", "tsn ext", "tsn exte" ],
- args: {
- command: { name: "context" },
- prefix: {
- value: options.requisition.system.commands.get("tsn"),
- status: "VALID",
- message: ""
- }
- }
- },
- exec: {
- output: "Using tsn as a command prefix"
- }
- },
- // For comparison with earlier
- {
- setup: "ext",
- check: {
- input: "ext",
- hints: " <text>",
- markup: "VVV",
- predictions: [ "tsn ext", "tsn exte", "tsn exten", "tsn extend" ],
- args: {
- command: { name: "tsn ext" },
- text: {
- value: undefined,
- arg: "",
- status: "INCOMPLETE"
- }
- }
- }
- },
- {
- setup: "ext test",
- check: {
- input: "ext test",
- hints: "",
- markup: "VVVVVVVV",
- args: {
- command: { name: "tsn ext" },
- text: {
- value: "test",
- arg: " test",
- status: "VALID",
- message: ""
- }
- }
- },
- exec: {
- output: "Exec: tsnExt text=test"
- }
- },
- {
- setup: "tsn",
- check: {
- input: "tsn",
- hints: " deep down nested cmd",
- markup: "III",
- message: "",
- predictionsContains: [ "tsn deep down nested cmd", "tsn ext", "tsn exte" ],
- args: {
- command: { name: "tsn" },
- }
- }
- },
- // Does it actually work?
- {
- setup: "tsb true",
- check: {
- input: "tsb true",
- hints: "",
- markup: "VVVVVVVV",
- options: [ "true" ],
- message: "",
- predictions: [ "true" ],
- unassigned: [ ],
- args: {
- command: { name: "tsb" },
- toggle: { value: true, arg: " true", status: "VALID", message: "" }
- }
- }
- },
- {
- // Bug 866710 - GCLI should allow argument merging for non-string parameters
- setup: "context tsn ext",
- skip: true
- },
- {
- setup: 'context "tsn ext"',
- check: {
- input: 'context "tsn ext"',
- hints: "",
- markup: "VVVVVVVVVVVVVVVVV",
- message: "",
- predictions: [ "tsn ext", "tsn exte", "tsn exten", "tsn extend" ],
- unassigned: [ ],
- args: {
- command: { name: "context" },
- prefix: {
- value: options.requisition.system.commands.get("tsn ext"),
- status: "VALID",
- message: ""
- }
- }
- },
- exec: {
- output: "Can't use 'tsn ext' as a prefix because it is not a parent command.",
- error: true
- }
- },
- /*
- {
- setup: 'context "tsn deep"',
- check: {
- input: 'context "tsn deep"',
- hints: '',
- markup: 'VVVVVVVVVVVVVVVVVV',
- status: 'ERROR',
- message: '',
- predictions: [ 'tsn deep' ],
- unassigned: [ ],
- args: {
- command: { name: 'context' },
- prefix: {
- value: options.requisition.system.commands.get('tsn deep'),
- status: 'VALID',
- message: ''
- }
- }
- },
- exec: {
- output: ''
- }
- },
- */
- {
- setup: "context",
- check: {
- input: "context",
- hints: " [prefix]",
- markup: "VVVVVVV",
- status: "VALID",
- unassigned: [ ],
- args: {
- command: { name: "context" },
- prefix: { value: undefined, arg: "", status: "VALID", message: "" },
- }
- },
- exec: {
- output: "Command prefix is unset",
- type: "string",
- error: false
- }
- }
- ]);
- };
|