browser/devtools/commandline/test/browser_gcli_string.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

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-testString.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 helpers = require('./helpers');
michael@0 44
michael@0 45 exports.testNewLine = function(options) {
michael@0 46 return helpers.audit(options, [
michael@0 47 {
michael@0 48 setup: 'echo a\\nb',
michael@0 49 check: {
michael@0 50 input: 'echo a\\nb',
michael@0 51 hints: '',
michael@0 52 markup: 'VVVVVVVVV',
michael@0 53 cursor: 9,
michael@0 54 current: 'message',
michael@0 55 status: 'VALID',
michael@0 56 args: {
michael@0 57 command: { name: 'echo' },
michael@0 58 message: {
michael@0 59 value: 'a\nb',
michael@0 60 arg: ' a\\nb',
michael@0 61 status: 'VALID',
michael@0 62 message: ''
michael@0 63 }
michael@0 64 }
michael@0 65 }
michael@0 66 }
michael@0 67 ]);
michael@0 68 };
michael@0 69
michael@0 70 exports.testTab = function(options) {
michael@0 71 return helpers.audit(options, [
michael@0 72 {
michael@0 73 setup: 'echo a\\tb',
michael@0 74 check: {
michael@0 75 input: 'echo a\\tb',
michael@0 76 hints: '',
michael@0 77 markup: 'VVVVVVVVV',
michael@0 78 cursor: 9,
michael@0 79 current: 'message',
michael@0 80 status: 'VALID',
michael@0 81 args: {
michael@0 82 command: { name: 'echo' },
michael@0 83 message: {
michael@0 84 value: 'a\tb',
michael@0 85 arg: ' a\\tb',
michael@0 86 status: 'VALID',
michael@0 87 message: ''
michael@0 88 }
michael@0 89 }
michael@0 90 }
michael@0 91 }
michael@0 92 ]);
michael@0 93 };
michael@0 94
michael@0 95 exports.testEscape = function(options) {
michael@0 96 return helpers.audit(options, [
michael@0 97 {
michael@0 98 // What's typed is actually:
michael@0 99 // tsrsrsr a\\ b c
michael@0 100 setup: 'tsrsrsr a\\\\ b c',
michael@0 101 check: {
michael@0 102 input: 'tsrsrsr a\\\\ b c',
michael@0 103 hints: '',
michael@0 104 markup: 'VVVVVVVVVVVVVVV',
michael@0 105 status: 'VALID',
michael@0 106 message: '',
michael@0 107 args: {
michael@0 108 command: { name: 'tsrsrsr' },
michael@0 109 p1: { value: 'a\\', arg: ' a\\\\', status: 'VALID', message: '' },
michael@0 110 p2: { value: 'b', arg: ' b', status: 'VALID', message: '' },
michael@0 111 p3: { value: 'c', arg: ' c', status: 'VALID', message: '' },
michael@0 112 }
michael@0 113 }
michael@0 114 },
michael@0 115 {
michael@0 116 // What's typed is actually:
michael@0 117 // tsrsrsr abc\\ndef asd asd
michael@0 118 setup: 'tsrsrsr abc\\\\ndef asd asd',
michael@0 119 check: {
michael@0 120 input: 'tsrsrsr abc\\\\ndef asd asd',
michael@0 121 hints: '',
michael@0 122 markup: 'VVVVVVVVVVVVVVVVVVVVVVVVV',
michael@0 123 status: 'VALID',
michael@0 124 message: '',
michael@0 125 args: {
michael@0 126 command: { name: 'tsrsrsr' },
michael@0 127 p1: {
michael@0 128 value: 'abc\\ndef',
michael@0 129 arg: ' abc\\\\ndef',
michael@0 130 status: 'VALID',
michael@0 131 message: ''
michael@0 132 },
michael@0 133 p2: { value: 'asd', arg: ' asd', status: 'VALID', message: '' },
michael@0 134 p3: { value: 'asd', arg: ' asd', status: 'VALID', message: '' },
michael@0 135 }
michael@0 136 }
michael@0 137 }
michael@0 138 ]);
michael@0 139 };
michael@0 140
michael@0 141 exports.testBlank = function(options) {
michael@0 142 return helpers.audit(options, [
michael@0 143 {
michael@0 144 setup: 'tsrsrsr a "" c',
michael@0 145 check: {
michael@0 146 input: 'tsrsrsr a "" c',
michael@0 147 hints: '',
michael@0 148 markup: 'VVVVVVVVVVVVVV',
michael@0 149 cursor: 14,
michael@0 150 current: 'p3',
michael@0 151 status: 'ERROR',
michael@0 152 message: '',
michael@0 153 args: {
michael@0 154 command: { name: 'tsrsrsr' },
michael@0 155 p1: {
michael@0 156 value: 'a',
michael@0 157 arg: ' a',
michael@0 158 status: 'VALID',
michael@0 159 message: ''
michael@0 160 },
michael@0 161 p2: {
michael@0 162 value: undefined,
michael@0 163 arg: ' ""',
michael@0 164 status: 'INCOMPLETE'
michael@0 165 },
michael@0 166 p3: {
michael@0 167 value: 'c',
michael@0 168 arg: ' c',
michael@0 169 status: 'VALID',
michael@0 170 message: ''
michael@0 171 }
michael@0 172 }
michael@0 173 }
michael@0 174 },
michael@0 175 {
michael@0 176 setup: 'tsrsrsr a b ""',
michael@0 177 check: {
michael@0 178 input: 'tsrsrsr a b ""',
michael@0 179 hints: '',
michael@0 180 markup: 'VVVVVVVVVVVVVV',
michael@0 181 cursor: 14,
michael@0 182 current: 'p3',
michael@0 183 status: 'VALID',
michael@0 184 message: '',
michael@0 185 args: {
michael@0 186 command: { name: 'tsrsrsr' },
michael@0 187 p1: {
michael@0 188 value: 'a',
michael@0 189 arg: ' a',
michael@0 190 status:'VALID',
michael@0 191 message: '' },
michael@0 192 p2: {
michael@0 193 value: 'b',
michael@0 194 arg: ' b',
michael@0 195 status: 'VALID',
michael@0 196 message: ''
michael@0 197 },
michael@0 198 p3: {
michael@0 199 value: '',
michael@0 200 arg: ' ""',
michael@0 201 status: 'VALID',
michael@0 202 message: ''
michael@0 203 }
michael@0 204 }
michael@0 205 }
michael@0 206 }
michael@0 207 ]);
michael@0 208 };
michael@0 209
michael@0 210 exports.testBlankWithParam = function(options) {
michael@0 211 return helpers.audit(options, [
michael@0 212 {
michael@0 213 setup: 'tsrsrsr a --p3',
michael@0 214 check: {
michael@0 215 input: 'tsrsrsr a --p3',
michael@0 216 hints: ' <string> <p2>',
michael@0 217 markup: 'VVVVVVVVVVVVVVV',
michael@0 218 cursor: 15,
michael@0 219 current: 'p3',
michael@0 220 status: 'ERROR',
michael@0 221 message: '',
michael@0 222 args: {
michael@0 223 command: { name: 'tsrsrsr' },
michael@0 224 p1: { value: 'a', arg: ' a', status: 'VALID', message: '' },
michael@0 225 p2: { value: undefined, arg: '', status: 'INCOMPLETE' },
michael@0 226 p3: { value: '', arg: ' --p3', status: 'VALID', message: '' },
michael@0 227 }
michael@0 228 }
michael@0 229 },
michael@0 230 {
michael@0 231 setup: 'tsrsrsr a --p3 ',
michael@0 232 check: {
michael@0 233 input: 'tsrsrsr a --p3 ',
michael@0 234 hints: '<string> <p2>',
michael@0 235 markup: 'VVVVVVVVVVVVVVVV',
michael@0 236 cursor: 16,
michael@0 237 current: 'p3',
michael@0 238 status: 'ERROR',
michael@0 239 message: '',
michael@0 240 args: {
michael@0 241 command: { name: 'tsrsrsr' },
michael@0 242 p1: { value: 'a', arg: ' a', status: 'VALID', message: '' },
michael@0 243 p2: { value: undefined, arg: '', status: 'INCOMPLETE' },
michael@0 244 p3: { value: '', arg: ' --p3 ', status: 'VALID', message: '' },
michael@0 245 }
michael@0 246 }
michael@0 247 },
michael@0 248 {
michael@0 249 setup: 'tsrsrsr a --p3 "',
michael@0 250 check: {
michael@0 251 input: 'tsrsrsr a --p3 "',
michael@0 252 hints: ' <p2>',
michael@0 253 markup: 'VVVVVVVVVVVVVVVVV',
michael@0 254 cursor: 17,
michael@0 255 current: 'p3',
michael@0 256 status: 'ERROR',
michael@0 257 message: '',
michael@0 258 args: {
michael@0 259 command: { name: 'tsrsrsr' },
michael@0 260 p1: { value: 'a', arg: ' a', status: 'VALID', message: '' },
michael@0 261 p2: { value: undefined, arg: '', status: 'INCOMPLETE' },
michael@0 262 p3: { value: '', arg: ' --p3 "', status: 'VALID', message: '' },
michael@0 263 }
michael@0 264 }
michael@0 265 },
michael@0 266 {
michael@0 267 setup: 'tsrsrsr a --p3 ""',
michael@0 268 check: {
michael@0 269 input: 'tsrsrsr a --p3 ""',
michael@0 270 hints: ' <p2>',
michael@0 271 markup: 'VVVVVVVVVVVVVVVVVV',
michael@0 272 cursor: 18,
michael@0 273 current: 'p3',
michael@0 274 status: 'ERROR',
michael@0 275 message: '',
michael@0 276 args: {
michael@0 277 command: { name: 'tsrsrsr' },
michael@0 278 p1: { value: 'a', arg: ' a', status: 'VALID', message: '' },
michael@0 279 p2: { value: undefined, arg: '', status: 'INCOMPLETE' },
michael@0 280 p3: { value: '', arg: ' --p3 ""', status: 'VALID', message: '' },
michael@0 281 }
michael@0 282 }
michael@0 283 }
michael@0 284 ]);
michael@0 285 };

mercurial