Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* |
michael@0 | 2 | * Copyright 2012, Mozilla Foundation and contributors |
michael@0 | 3 | * |
michael@0 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
michael@0 | 5 | * you may not use this file except in compliance with the License. |
michael@0 | 6 | * You may obtain a copy of the License at |
michael@0 | 7 | * |
michael@0 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
michael@0 | 9 | * |
michael@0 | 10 | * Unless required by applicable law or agreed to in writing, software |
michael@0 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
michael@0 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
michael@0 | 13 | * See the License for the specific language governing permissions and |
michael@0 | 14 | * limitations under the License. |
michael@0 | 15 | */ |
michael@0 | 16 | |
michael@0 | 17 | 'use strict'; |
michael@0 | 18 | // <INJECTED SOURCE:START> |
michael@0 | 19 | |
michael@0 | 20 | // THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT |
michael@0 | 21 | // DO NOT EDIT IT DIRECTLY |
michael@0 | 22 | |
michael@0 | 23 | var exports = {}; |
michael@0 | 24 | |
michael@0 | 25 | var TEST_URI = "data:text/html;charset=utf-8,<p id='gcli-input'>gcli-testExec.js</p>"; |
michael@0 | 26 | |
michael@0 | 27 | function test() { |
michael@0 | 28 | return Task.spawn(function() { |
michael@0 | 29 | let options = yield helpers.openTab(TEST_URI); |
michael@0 | 30 | yield helpers.openToolbar(options); |
michael@0 | 31 | gcli.addItems(mockCommands.items); |
michael@0 | 32 | |
michael@0 | 33 | yield helpers.runTests(options, exports); |
michael@0 | 34 | |
michael@0 | 35 | gcli.removeItems(mockCommands.items); |
michael@0 | 36 | yield helpers.closeToolbar(options); |
michael@0 | 37 | yield helpers.closeTab(options); |
michael@0 | 38 | }).then(finish, helpers.handleError); |
michael@0 | 39 | } |
michael@0 | 40 | |
michael@0 | 41 | // <INJECTED SOURCE:END> |
michael@0 | 42 | |
michael@0 | 43 | // var assert = require('../testharness/assert'); |
michael@0 | 44 | // var helpers = require('./helpers'); |
michael@0 | 45 | var nodetype = require('gcli/types/node'); |
michael@0 | 46 | |
michael@0 | 47 | var mockBody = { |
michael@0 | 48 | style: {} |
michael@0 | 49 | }; |
michael@0 | 50 | |
michael@0 | 51 | var mockEmptyNodeList = { |
michael@0 | 52 | length: 0, |
michael@0 | 53 | item: function() { return null; } |
michael@0 | 54 | }; |
michael@0 | 55 | |
michael@0 | 56 | var mockRootNodeList = { |
michael@0 | 57 | length: 1, |
michael@0 | 58 | item: function(i) { return mockBody; } |
michael@0 | 59 | }; |
michael@0 | 60 | |
michael@0 | 61 | var mockDoc = { |
michael@0 | 62 | querySelectorAll: function(css) { |
michael@0 | 63 | return (css === ':root') ? mockRootNodeList : mockEmptyNodeList; |
michael@0 | 64 | } |
michael@0 | 65 | }; |
michael@0 | 66 | |
michael@0 | 67 | exports.testParamGroup = function(options) { |
michael@0 | 68 | var tsg = options.requisition.canon.getCommand('tsg'); |
michael@0 | 69 | |
michael@0 | 70 | assert.is(tsg.params[0].groupName, null, 'tsg param 0 group null'); |
michael@0 | 71 | assert.is(tsg.params[1].groupName, 'First', 'tsg param 1 group First'); |
michael@0 | 72 | assert.is(tsg.params[2].groupName, 'First', 'tsg param 2 group First'); |
michael@0 | 73 | assert.is(tsg.params[3].groupName, 'Second', 'tsg param 3 group Second'); |
michael@0 | 74 | assert.is(tsg.params[4].groupName, 'Second', 'tsg param 4 group Second'); |
michael@0 | 75 | }; |
michael@0 | 76 | |
michael@0 | 77 | exports.testWithHelpers = function(options) { |
michael@0 | 78 | return helpers.audit(options, [ |
michael@0 | 79 | { |
michael@0 | 80 | setup: 'tss', |
michael@0 | 81 | check: { |
michael@0 | 82 | input: 'tss', |
michael@0 | 83 | hints: '', |
michael@0 | 84 | markup: 'VVV', |
michael@0 | 85 | cursor: 3, |
michael@0 | 86 | current: '__command', |
michael@0 | 87 | status: 'VALID', |
michael@0 | 88 | unassigned: [ ], |
michael@0 | 89 | args: { |
michael@0 | 90 | command: { name: 'tss' }, |
michael@0 | 91 | } |
michael@0 | 92 | }, |
michael@0 | 93 | exec: { |
michael@0 | 94 | output: /^Exec: tss/, |
michael@0 | 95 | } |
michael@0 | 96 | }, |
michael@0 | 97 | { |
michael@0 | 98 | setup: 'tsv option1 10', |
michael@0 | 99 | check: { |
michael@0 | 100 | input: 'tsv option1 10', |
michael@0 | 101 | hints: '', |
michael@0 | 102 | markup: 'VVVVVVVVVVVVVV', |
michael@0 | 103 | cursor: 14, |
michael@0 | 104 | current: 'optionValue', |
michael@0 | 105 | status: 'VALID', |
michael@0 | 106 | predictions: [ ], |
michael@0 | 107 | unassigned: [ ], |
michael@0 | 108 | args: { |
michael@0 | 109 | command: { name: 'tsv' }, |
michael@0 | 110 | optionType: { |
michael@0 | 111 | value: 'string', |
michael@0 | 112 | arg: ' option1', |
michael@0 | 113 | status: 'VALID', |
michael@0 | 114 | message: '' |
michael@0 | 115 | }, |
michael@0 | 116 | optionValue: { |
michael@0 | 117 | arg: ' 10', |
michael@0 | 118 | status: 'VALID', |
michael@0 | 119 | message: '' |
michael@0 | 120 | } |
michael@0 | 121 | } |
michael@0 | 122 | }, |
michael@0 | 123 | exec: { |
michael@0 | 124 | output: 'Exec: tsv optionType=string, optionValue=10' |
michael@0 | 125 | } |
michael@0 | 126 | }, |
michael@0 | 127 | { |
michael@0 | 128 | setup: 'tsv option2 10', |
michael@0 | 129 | check: { |
michael@0 | 130 | input: 'tsv option2 10', |
michael@0 | 131 | hints: '', |
michael@0 | 132 | markup: 'VVVVVVVVVVVVVV', |
michael@0 | 133 | cursor: 14, |
michael@0 | 134 | current: 'optionValue', |
michael@0 | 135 | status: 'VALID', |
michael@0 | 136 | predictions: [ ], |
michael@0 | 137 | unassigned: [ ], |
michael@0 | 138 | args: { |
michael@0 | 139 | command: { name: 'tsv' }, |
michael@0 | 140 | optionType: { |
michael@0 | 141 | value: 'number', |
michael@0 | 142 | arg: ' option2', |
michael@0 | 143 | status: 'VALID', |
michael@0 | 144 | message: '' |
michael@0 | 145 | }, |
michael@0 | 146 | optionValue: { |
michael@0 | 147 | arg: ' 10', |
michael@0 | 148 | status: 'VALID', |
michael@0 | 149 | message: '' |
michael@0 | 150 | } |
michael@0 | 151 | } |
michael@0 | 152 | }, |
michael@0 | 153 | exec: { |
michael@0 | 154 | output: 'Exec: tsv optionType=number, optionValue=10' |
michael@0 | 155 | } |
michael@0 | 156 | }, |
michael@0 | 157 | // Delegated remote types can't transfer value types so we only test for |
michael@0 | 158 | // the value of optionValue when we're local |
michael@0 | 159 | { |
michael@0 | 160 | skipIf: options.isRemote, |
michael@0 | 161 | setup: 'tsv option1 10', |
michael@0 | 162 | check: { |
michael@0 | 163 | args: { optionValue: { value: '10' } } |
michael@0 | 164 | }, |
michael@0 | 165 | exec: { |
michael@0 | 166 | output: 'Exec: tsv optionType=string, optionValue=10' |
michael@0 | 167 | } |
michael@0 | 168 | }, |
michael@0 | 169 | { |
michael@0 | 170 | skipIf: options.isRemote, |
michael@0 | 171 | setup: 'tsv option2 10', |
michael@0 | 172 | check: { |
michael@0 | 173 | args: { optionValue: { value: 10 } } |
michael@0 | 174 | }, |
michael@0 | 175 | exec: { |
michael@0 | 176 | output: 'Exec: tsv optionType=number, optionValue=10' |
michael@0 | 177 | } |
michael@0 | 178 | } |
michael@0 | 179 | ]); |
michael@0 | 180 | }; |
michael@0 | 181 | |
michael@0 | 182 | exports.testExecText = function(options) { |
michael@0 | 183 | return helpers.audit(options, [ |
michael@0 | 184 | { |
michael@0 | 185 | setup: 'tsr fred', |
michael@0 | 186 | check: { |
michael@0 | 187 | input: 'tsr fred', |
michael@0 | 188 | hints: '', |
michael@0 | 189 | markup: 'VVVVVVVV', |
michael@0 | 190 | cursor: 8, |
michael@0 | 191 | current: 'text', |
michael@0 | 192 | status: 'VALID', |
michael@0 | 193 | predictions: [ ], |
michael@0 | 194 | unassigned: [ ], |
michael@0 | 195 | args: { |
michael@0 | 196 | command: { name: 'tsr' }, |
michael@0 | 197 | text: { |
michael@0 | 198 | value: 'fred', |
michael@0 | 199 | arg: ' fred', |
michael@0 | 200 | status: 'VALID', |
michael@0 | 201 | message: '' |
michael@0 | 202 | } |
michael@0 | 203 | } |
michael@0 | 204 | }, |
michael@0 | 205 | exec: { |
michael@0 | 206 | output: 'Exec: tsr text=fred' |
michael@0 | 207 | } |
michael@0 | 208 | }, |
michael@0 | 209 | { |
michael@0 | 210 | setup: 'tsr fred bloggs', |
michael@0 | 211 | check: { |
michael@0 | 212 | input: 'tsr fred bloggs', |
michael@0 | 213 | hints: '', |
michael@0 | 214 | markup: 'VVVVVVVVVVVVVVV', |
michael@0 | 215 | cursor: 15, |
michael@0 | 216 | current: 'text', |
michael@0 | 217 | status: 'VALID', |
michael@0 | 218 | predictions: [ ], |
michael@0 | 219 | unassigned: [ ], |
michael@0 | 220 | args: { |
michael@0 | 221 | command: { name: 'tsr' }, |
michael@0 | 222 | text: { |
michael@0 | 223 | value: 'fred bloggs', |
michael@0 | 224 | arg: ' fred bloggs', |
michael@0 | 225 | status: 'VALID', |
michael@0 | 226 | message: '' |
michael@0 | 227 | } |
michael@0 | 228 | } |
michael@0 | 229 | }, |
michael@0 | 230 | exec: { |
michael@0 | 231 | output: 'Exec: tsr text=fred bloggs' |
michael@0 | 232 | } |
michael@0 | 233 | }, |
michael@0 | 234 | { |
michael@0 | 235 | setup: 'tsr "fred bloggs"', |
michael@0 | 236 | check: { |
michael@0 | 237 | input: 'tsr "fred bloggs"', |
michael@0 | 238 | hints: '', |
michael@0 | 239 | markup: 'VVVVVVVVVVVVVVVVV', |
michael@0 | 240 | cursor: 17, |
michael@0 | 241 | current: 'text', |
michael@0 | 242 | status: 'VALID', |
michael@0 | 243 | predictions: [ ], |
michael@0 | 244 | unassigned: [ ], |
michael@0 | 245 | args: { |
michael@0 | 246 | command: { name: 'tsr' }, |
michael@0 | 247 | text: { |
michael@0 | 248 | value: 'fred bloggs', |
michael@0 | 249 | arg: ' "fred bloggs"', |
michael@0 | 250 | status: 'VALID', |
michael@0 | 251 | message: '' |
michael@0 | 252 | } |
michael@0 | 253 | } |
michael@0 | 254 | }, |
michael@0 | 255 | exec: { |
michael@0 | 256 | output: 'Exec: tsr text=fred bloggs' |
michael@0 | 257 | } |
michael@0 | 258 | }, |
michael@0 | 259 | { |
michael@0 | 260 | setup: 'tsr "fred bloggs', |
michael@0 | 261 | check: { |
michael@0 | 262 | input: 'tsr "fred bloggs', |
michael@0 | 263 | hints: '', |
michael@0 | 264 | markup: 'VVVVVVVVVVVVVVVV', |
michael@0 | 265 | cursor: 16, |
michael@0 | 266 | current: 'text', |
michael@0 | 267 | status: 'VALID', |
michael@0 | 268 | predictions: [ ], |
michael@0 | 269 | unassigned: [ ], |
michael@0 | 270 | args: { |
michael@0 | 271 | command: { name: 'tsr' }, |
michael@0 | 272 | text: { |
michael@0 | 273 | value: 'fred bloggs', |
michael@0 | 274 | arg: ' "fred bloggs', |
michael@0 | 275 | status: 'VALID', |
michael@0 | 276 | message: '' |
michael@0 | 277 | } |
michael@0 | 278 | } |
michael@0 | 279 | }, |
michael@0 | 280 | exec: { |
michael@0 | 281 | output: 'Exec: tsr text=fred bloggs' |
michael@0 | 282 | } |
michael@0 | 283 | } |
michael@0 | 284 | ]); |
michael@0 | 285 | }; |
michael@0 | 286 | |
michael@0 | 287 | exports.testExecBoolean = function(options) { |
michael@0 | 288 | return helpers.audit(options, [ |
michael@0 | 289 | { |
michael@0 | 290 | setup: 'tsb', |
michael@0 | 291 | check: { |
michael@0 | 292 | input: 'tsb', |
michael@0 | 293 | hints: ' [toggle]', |
michael@0 | 294 | markup: 'VVV', |
michael@0 | 295 | cursor: 3, |
michael@0 | 296 | current: '__command', |
michael@0 | 297 | status: 'VALID', |
michael@0 | 298 | predictions: [ ], |
michael@0 | 299 | unassigned: [ ], |
michael@0 | 300 | args: { |
michael@0 | 301 | command: { name: 'tsb' }, |
michael@0 | 302 | toggle: { |
michael@0 | 303 | value: false, |
michael@0 | 304 | arg: '', |
michael@0 | 305 | status: 'VALID', |
michael@0 | 306 | message: '' |
michael@0 | 307 | } |
michael@0 | 308 | } |
michael@0 | 309 | }, |
michael@0 | 310 | exec: { |
michael@0 | 311 | output: 'Exec: tsb toggle=false' |
michael@0 | 312 | } |
michael@0 | 313 | }, |
michael@0 | 314 | { |
michael@0 | 315 | setup: 'tsb --toggle', |
michael@0 | 316 | check: { |
michael@0 | 317 | input: 'tsb --toggle', |
michael@0 | 318 | hints: '', |
michael@0 | 319 | markup: 'VVVVVVVVVVVV', |
michael@0 | 320 | cursor: 12, |
michael@0 | 321 | current: 'toggle', |
michael@0 | 322 | status: 'VALID', |
michael@0 | 323 | predictions: [ ], |
michael@0 | 324 | unassigned: [ ], |
michael@0 | 325 | outputState: 'false:default', |
michael@0 | 326 | args: { |
michael@0 | 327 | command: { name: 'tsb' }, |
michael@0 | 328 | toggle: { |
michael@0 | 329 | value: true, |
michael@0 | 330 | arg: ' --toggle', |
michael@0 | 331 | status: 'VALID', |
michael@0 | 332 | message: '' |
michael@0 | 333 | } |
michael@0 | 334 | } |
michael@0 | 335 | }, |
michael@0 | 336 | exec: { |
michael@0 | 337 | output: 'Exec: tsb toggle=true' |
michael@0 | 338 | } |
michael@0 | 339 | } |
michael@0 | 340 | ]); |
michael@0 | 341 | }; |
michael@0 | 342 | |
michael@0 | 343 | exports.testExecNumber = function(options) { |
michael@0 | 344 | return helpers.audit(options, [ |
michael@0 | 345 | { |
michael@0 | 346 | setup: 'tsu 10', |
michael@0 | 347 | check: { |
michael@0 | 348 | input: 'tsu 10', |
michael@0 | 349 | hints: '', |
michael@0 | 350 | markup: 'VVVVVV', |
michael@0 | 351 | cursor: 6, |
michael@0 | 352 | current: 'num', |
michael@0 | 353 | status: 'VALID', |
michael@0 | 354 | predictions: [ ], |
michael@0 | 355 | unassigned: [ ], |
michael@0 | 356 | args: { |
michael@0 | 357 | command: { name: 'tsu' }, |
michael@0 | 358 | num: { value: 10, arg: ' 10', status: 'VALID', message: '' } |
michael@0 | 359 | } |
michael@0 | 360 | }, |
michael@0 | 361 | exec: { |
michael@0 | 362 | output: 'Exec: tsu num=10' |
michael@0 | 363 | } |
michael@0 | 364 | }, |
michael@0 | 365 | { |
michael@0 | 366 | setup: 'tsu --num 10', |
michael@0 | 367 | check: { |
michael@0 | 368 | input: 'tsu --num 10', |
michael@0 | 369 | hints: '', |
michael@0 | 370 | markup: 'VVVVVVVVVVVV', |
michael@0 | 371 | cursor: 12, |
michael@0 | 372 | current: 'num', |
michael@0 | 373 | status: 'VALID', |
michael@0 | 374 | predictions: [ ], |
michael@0 | 375 | unassigned: [ ], |
michael@0 | 376 | args: { |
michael@0 | 377 | command: { name: 'tsu' }, |
michael@0 | 378 | num: { value: 10, arg: ' --num 10', status: 'VALID', message: '' } |
michael@0 | 379 | } |
michael@0 | 380 | }, |
michael@0 | 381 | exec: { |
michael@0 | 382 | output: 'Exec: tsu num=10' |
michael@0 | 383 | } |
michael@0 | 384 | } |
michael@0 | 385 | ]); |
michael@0 | 386 | }; |
michael@0 | 387 | |
michael@0 | 388 | exports.testExecScript = function(options) { |
michael@0 | 389 | return helpers.audit(options, [ |
michael@0 | 390 | { |
michael@0 | 391 | // Bug 704829 - Enable GCLI Javascript parameters |
michael@0 | 392 | // The answer to this should be 2 |
michael@0 | 393 | setup: 'tsj { 1 + 1 }', |
michael@0 | 394 | check: { |
michael@0 | 395 | input: 'tsj { 1 + 1 }', |
michael@0 | 396 | hints: '', |
michael@0 | 397 | markup: 'VVVVVVVVVVVVV', |
michael@0 | 398 | cursor: 13, |
michael@0 | 399 | current: 'javascript', |
michael@0 | 400 | status: 'VALID', |
michael@0 | 401 | predictions: [ ], |
michael@0 | 402 | unassigned: [ ], |
michael@0 | 403 | args: { |
michael@0 | 404 | command: { name: 'tsj' }, |
michael@0 | 405 | javascript: { |
michael@0 | 406 | value: '1 + 1', |
michael@0 | 407 | arg: ' { 1 + 1 }', |
michael@0 | 408 | status: 'VALID', |
michael@0 | 409 | message: '' |
michael@0 | 410 | } |
michael@0 | 411 | } |
michael@0 | 412 | }, |
michael@0 | 413 | exec: { |
michael@0 | 414 | output: 'Exec: tsj javascript=1 + 1' |
michael@0 | 415 | } |
michael@0 | 416 | } |
michael@0 | 417 | ]); |
michael@0 | 418 | }; |
michael@0 | 419 | |
michael@0 | 420 | exports.testExecNode = function(options) { |
michael@0 | 421 | var origDoc = nodetype.getDocument(); |
michael@0 | 422 | nodetype.setDocument(mockDoc); |
michael@0 | 423 | |
michael@0 | 424 | return helpers.audit(options, [ |
michael@0 | 425 | { |
michael@0 | 426 | skipIf: options.isRemote, // No DOM on server |
michael@0 | 427 | setup: 'tse :root', |
michael@0 | 428 | check: { |
michael@0 | 429 | input: 'tse :root', |
michael@0 | 430 | hints: ' [options]', |
michael@0 | 431 | markup: 'VVVVVVVVV', |
michael@0 | 432 | cursor: 9, |
michael@0 | 433 | current: 'node', |
michael@0 | 434 | status: 'VALID', |
michael@0 | 435 | predictions: [ ], |
michael@0 | 436 | unassigned: [ ], |
michael@0 | 437 | args: { |
michael@0 | 438 | command: { name: 'tse' }, |
michael@0 | 439 | node: { |
michael@0 | 440 | value: mockBody, |
michael@0 | 441 | arg: ' :root', |
michael@0 | 442 | status: 'VALID', |
michael@0 | 443 | message: '' |
michael@0 | 444 | }, |
michael@0 | 445 | nodes: { |
michael@0 | 446 | value: mockEmptyNodeList, |
michael@0 | 447 | arg: '', |
michael@0 | 448 | status: 'VALID', |
michael@0 | 449 | message: '' |
michael@0 | 450 | }, |
michael@0 | 451 | nodes2: { |
michael@0 | 452 | value: mockEmptyNodeList, |
michael@0 | 453 | arg: '', |
michael@0 | 454 | status: 'VALID', |
michael@0 | 455 | message: '' |
michael@0 | 456 | } |
michael@0 | 457 | } |
michael@0 | 458 | }, |
michael@0 | 459 | exec: { |
michael@0 | 460 | output: /^Exec: tse/ |
michael@0 | 461 | }, |
michael@0 | 462 | post: function() { |
michael@0 | 463 | nodetype.setDocument(origDoc); |
michael@0 | 464 | } |
michael@0 | 465 | } |
michael@0 | 466 | ]); |
michael@0 | 467 | }; |
michael@0 | 468 | |
michael@0 | 469 | exports.testExecSubCommand = function(options) { |
michael@0 | 470 | return helpers.audit(options, [ |
michael@0 | 471 | { |
michael@0 | 472 | setup: 'tsn dif fred', |
michael@0 | 473 | check: { |
michael@0 | 474 | input: 'tsn dif fred', |
michael@0 | 475 | hints: '', |
michael@0 | 476 | markup: 'VVVVVVVVVVVV', |
michael@0 | 477 | cursor: 12, |
michael@0 | 478 | current: 'text', |
michael@0 | 479 | status: 'VALID', |
michael@0 | 480 | predictions: [ ], |
michael@0 | 481 | unassigned: [ ], |
michael@0 | 482 | args: { |
michael@0 | 483 | command: { name: 'tsn dif' }, |
michael@0 | 484 | text: { value: 'fred', arg: ' fred', status: 'VALID', message: '' } |
michael@0 | 485 | } |
michael@0 | 486 | }, |
michael@0 | 487 | exec: { |
michael@0 | 488 | output: 'Exec: tsnDif text=fred' |
michael@0 | 489 | } |
michael@0 | 490 | }, |
michael@0 | 491 | { |
michael@0 | 492 | setup: 'tsn exten fred', |
michael@0 | 493 | check: { |
michael@0 | 494 | input: 'tsn exten fred', |
michael@0 | 495 | hints: '', |
michael@0 | 496 | markup: 'VVVVVVVVVVVVVV', |
michael@0 | 497 | cursor: 14, |
michael@0 | 498 | current: 'text', |
michael@0 | 499 | status: 'VALID', |
michael@0 | 500 | predictions: [ ], |
michael@0 | 501 | unassigned: [ ], |
michael@0 | 502 | args: { |
michael@0 | 503 | command: { name: 'tsn exten' }, |
michael@0 | 504 | text: { value: 'fred', arg: ' fred', status: 'VALID', message: '' }, |
michael@0 | 505 | } |
michael@0 | 506 | }, |
michael@0 | 507 | exec: { |
michael@0 | 508 | output: 'Exec: tsnExten text=fred' |
michael@0 | 509 | } |
michael@0 | 510 | }, |
michael@0 | 511 | { |
michael@0 | 512 | setup: 'tsn extend fred', |
michael@0 | 513 | check: { |
michael@0 | 514 | input: 'tsn extend fred', |
michael@0 | 515 | hints: '', |
michael@0 | 516 | markup: 'VVVVVVVVVVVVVVV', |
michael@0 | 517 | cursor: 15, |
michael@0 | 518 | current: 'text', |
michael@0 | 519 | status: 'VALID', |
michael@0 | 520 | predictions: [ ], |
michael@0 | 521 | unassigned: [ ], |
michael@0 | 522 | args: { |
michael@0 | 523 | command: { name: 'tsn extend' }, |
michael@0 | 524 | text: { value: 'fred', arg: ' fred', status: 'VALID', message: '' }, |
michael@0 | 525 | } |
michael@0 | 526 | }, |
michael@0 | 527 | exec: { |
michael@0 | 528 | output: 'Exec: tsnExtend text=fred' |
michael@0 | 529 | } |
michael@0 | 530 | } |
michael@0 | 531 | ]); |
michael@0 | 532 | }; |
michael@0 | 533 | |
michael@0 | 534 | exports.testExecArray = function(options) { |
michael@0 | 535 | return helpers.audit(options, [ |
michael@0 | 536 | { |
michael@0 | 537 | setup: 'tselarr 1', |
michael@0 | 538 | check: { |
michael@0 | 539 | input: 'tselarr 1', |
michael@0 | 540 | hints: '', |
michael@0 | 541 | markup: 'VVVVVVVVV', |
michael@0 | 542 | cursor: 9, |
michael@0 | 543 | current: 'num', |
michael@0 | 544 | status: 'VALID', |
michael@0 | 545 | predictions: ['1'], |
michael@0 | 546 | unassigned: [ ], |
michael@0 | 547 | outputState: 'false:default', |
michael@0 | 548 | args: { |
michael@0 | 549 | command: { name: 'tselarr' }, |
michael@0 | 550 | num: { value: '1', arg: ' 1', status: 'VALID', message: '' }, |
michael@0 | 551 | arr: { /*value:,*/ arg: '{}', status: 'VALID', message: '' }, |
michael@0 | 552 | } |
michael@0 | 553 | }, |
michael@0 | 554 | exec: { |
michael@0 | 555 | output: 'Exec: tselarr num=1, arr=' |
michael@0 | 556 | } |
michael@0 | 557 | }, |
michael@0 | 558 | { |
michael@0 | 559 | setup: 'tselarr 1 a', |
michael@0 | 560 | check: { |
michael@0 | 561 | input: 'tselarr 1 a', |
michael@0 | 562 | hints: '', |
michael@0 | 563 | markup: 'VVVVVVVVVVV', |
michael@0 | 564 | cursor: 11, |
michael@0 | 565 | current: 'arr', |
michael@0 | 566 | status: 'VALID', |
michael@0 | 567 | predictions: [ ], |
michael@0 | 568 | unassigned: [ ], |
michael@0 | 569 | args: { |
michael@0 | 570 | command: { name: 'tselarr' }, |
michael@0 | 571 | num: { value: '1', arg: ' 1', status: 'VALID', message: '' }, |
michael@0 | 572 | arr: { /*value:a,*/ arg: '{ a}', status: 'VALID', message: '' }, |
michael@0 | 573 | } |
michael@0 | 574 | }, |
michael@0 | 575 | exec: { |
michael@0 | 576 | output: 'Exec: tselarr num=1, arr=a' |
michael@0 | 577 | } |
michael@0 | 578 | }, |
michael@0 | 579 | { |
michael@0 | 580 | setup: 'tselarr 1 a b', |
michael@0 | 581 | check: { |
michael@0 | 582 | input: 'tselarr 1 a b', |
michael@0 | 583 | hints: '', |
michael@0 | 584 | markup: 'VVVVVVVVVVVVV', |
michael@0 | 585 | cursor: 13, |
michael@0 | 586 | current: 'arr', |
michael@0 | 587 | status: 'VALID', |
michael@0 | 588 | predictions: [ ], |
michael@0 | 589 | unassigned: [ ], |
michael@0 | 590 | args: { |
michael@0 | 591 | command: { name: 'tselarr' }, |
michael@0 | 592 | num: { value: '1', arg: ' 1', status: 'VALID', message: '' }, |
michael@0 | 593 | arr: { /*value:a,b,*/ arg: '{ a, b}', status: 'VALID', message: '' }, |
michael@0 | 594 | } |
michael@0 | 595 | }, |
michael@0 | 596 | exec: { |
michael@0 | 597 | output: 'Exec: tselarr num=1, arr=a,b' |
michael@0 | 598 | } |
michael@0 | 599 | } |
michael@0 | 600 | ]); |
michael@0 | 601 | }; |
michael@0 | 602 | |
michael@0 | 603 | exports.testExecMultiple = function(options) { |
michael@0 | 604 | return helpers.audit(options, [ |
michael@0 | 605 | { |
michael@0 | 606 | setup: 'tsm a 10 10', |
michael@0 | 607 | check: { |
michael@0 | 608 | input: 'tsm a 10 10', |
michael@0 | 609 | hints: '', |
michael@0 | 610 | markup: 'VVVVVVVVVVV', |
michael@0 | 611 | cursor: 11, |
michael@0 | 612 | current: 'num', |
michael@0 | 613 | status: 'VALID', |
michael@0 | 614 | predictions: [ ], |
michael@0 | 615 | unassigned: [ ], |
michael@0 | 616 | args: { |
michael@0 | 617 | command: { name: 'tsm' }, |
michael@0 | 618 | abc: { value: 'a', arg: ' a', status: 'VALID', message: '' }, |
michael@0 | 619 | txt: { value: '10', arg: ' 10', status: 'VALID', message: '' }, |
michael@0 | 620 | num: { value: 10, arg: ' 10', status: 'VALID', message: '' }, |
michael@0 | 621 | } |
michael@0 | 622 | }, |
michael@0 | 623 | exec: { |
michael@0 | 624 | output: 'Exec: tsm abc=a, txt=10, num=10' |
michael@0 | 625 | } |
michael@0 | 626 | } |
michael@0 | 627 | ]); |
michael@0 | 628 | }; |
michael@0 | 629 | |
michael@0 | 630 | exports.testExecDefaults = function(options) { |
michael@0 | 631 | return helpers.audit(options, [ |
michael@0 | 632 | { |
michael@0 | 633 | // Bug 707009 - GCLI doesn't always fill in default parameters properly |
michael@0 | 634 | setup: 'tsg aaa', |
michael@0 | 635 | check: { |
michael@0 | 636 | input: 'tsg aaa', |
michael@0 | 637 | hints: ' [options]', |
michael@0 | 638 | markup: 'VVVVVVV', |
michael@0 | 639 | cursor: 7, |
michael@0 | 640 | current: 'solo', |
michael@0 | 641 | status: 'VALID', |
michael@0 | 642 | predictions: ['aaa'], |
michael@0 | 643 | unassigned: [ ], |
michael@0 | 644 | args: { |
michael@0 | 645 | command: { name: 'tsg' }, |
michael@0 | 646 | solo: { value: 'aaa', arg: ' aaa', status: 'VALID', message: '' }, |
michael@0 | 647 | txt1: { value: undefined, arg: '', status: 'VALID', message: '' }, |
michael@0 | 648 | bool: { value: false, arg: '', status: 'VALID', message: '' }, |
michael@0 | 649 | txt2: { value: undefined, arg: '', status: 'VALID', message: '' }, |
michael@0 | 650 | num: { value: undefined, arg: '', status: 'VALID', message: '' }, |
michael@0 | 651 | } |
michael@0 | 652 | }, |
michael@0 | 653 | exec: { |
michael@0 | 654 | output: 'Exec: tsg solo=aaa, txt1=null, bool=false, txt2=d, num=42' |
michael@0 | 655 | } |
michael@0 | 656 | } |
michael@0 | 657 | ]); |
michael@0 | 658 | |
michael@0 | 659 | }; |