1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/commandline/test/browser_gcli_string.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,285 @@ 1.4 +/* 1.5 + * Copyright 2012, Mozilla Foundation and contributors 1.6 + * 1.7 + * Licensed under the Apache License, Version 2.0 (the "License"); 1.8 + * you may not use this file except in compliance with the License. 1.9 + * You may obtain a copy of the License at 1.10 + * 1.11 + * http://www.apache.org/licenses/LICENSE-2.0 1.12 + * 1.13 + * Unless required by applicable law or agreed to in writing, software 1.14 + * distributed under the License is distributed on an "AS IS" BASIS, 1.15 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1.16 + * See the License for the specific language governing permissions and 1.17 + * limitations under the License. 1.18 + */ 1.19 + 1.20 +'use strict'; 1.21 +// <INJECTED SOURCE:START> 1.22 + 1.23 +// THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT 1.24 +// DO NOT EDIT IT DIRECTLY 1.25 + 1.26 +var exports = {}; 1.27 + 1.28 +var TEST_URI = "data:text/html;charset=utf-8,<p id='gcli-input'>gcli-testString.js</p>"; 1.29 + 1.30 +function test() { 1.31 + return Task.spawn(function() { 1.32 + let options = yield helpers.openTab(TEST_URI); 1.33 + yield helpers.openToolbar(options); 1.34 + gcli.addItems(mockCommands.items); 1.35 + 1.36 + yield helpers.runTests(options, exports); 1.37 + 1.38 + gcli.removeItems(mockCommands.items); 1.39 + yield helpers.closeToolbar(options); 1.40 + yield helpers.closeTab(options); 1.41 + }).then(finish, helpers.handleError); 1.42 +} 1.43 + 1.44 +// <INJECTED SOURCE:END> 1.45 + 1.46 +// var helpers = require('./helpers'); 1.47 + 1.48 +exports.testNewLine = function(options) { 1.49 + return helpers.audit(options, [ 1.50 + { 1.51 + setup: 'echo a\\nb', 1.52 + check: { 1.53 + input: 'echo a\\nb', 1.54 + hints: '', 1.55 + markup: 'VVVVVVVVV', 1.56 + cursor: 9, 1.57 + current: 'message', 1.58 + status: 'VALID', 1.59 + args: { 1.60 + command: { name: 'echo' }, 1.61 + message: { 1.62 + value: 'a\nb', 1.63 + arg: ' a\\nb', 1.64 + status: 'VALID', 1.65 + message: '' 1.66 + } 1.67 + } 1.68 + } 1.69 + } 1.70 + ]); 1.71 +}; 1.72 + 1.73 +exports.testTab = function(options) { 1.74 + return helpers.audit(options, [ 1.75 + { 1.76 + setup: 'echo a\\tb', 1.77 + check: { 1.78 + input: 'echo a\\tb', 1.79 + hints: '', 1.80 + markup: 'VVVVVVVVV', 1.81 + cursor: 9, 1.82 + current: 'message', 1.83 + status: 'VALID', 1.84 + args: { 1.85 + command: { name: 'echo' }, 1.86 + message: { 1.87 + value: 'a\tb', 1.88 + arg: ' a\\tb', 1.89 + status: 'VALID', 1.90 + message: '' 1.91 + } 1.92 + } 1.93 + } 1.94 + } 1.95 + ]); 1.96 +}; 1.97 + 1.98 +exports.testEscape = function(options) { 1.99 + return helpers.audit(options, [ 1.100 + { 1.101 + // What's typed is actually: 1.102 + // tsrsrsr a\\ b c 1.103 + setup: 'tsrsrsr a\\\\ b c', 1.104 + check: { 1.105 + input: 'tsrsrsr a\\\\ b c', 1.106 + hints: '', 1.107 + markup: 'VVVVVVVVVVVVVVV', 1.108 + status: 'VALID', 1.109 + message: '', 1.110 + args: { 1.111 + command: { name: 'tsrsrsr' }, 1.112 + p1: { value: 'a\\', arg: ' a\\\\', status: 'VALID', message: '' }, 1.113 + p2: { value: 'b', arg: ' b', status: 'VALID', message: '' }, 1.114 + p3: { value: 'c', arg: ' c', status: 'VALID', message: '' }, 1.115 + } 1.116 + } 1.117 + }, 1.118 + { 1.119 + // What's typed is actually: 1.120 + // tsrsrsr abc\\ndef asd asd 1.121 + setup: 'tsrsrsr abc\\\\ndef asd asd', 1.122 + check: { 1.123 + input: 'tsrsrsr abc\\\\ndef asd asd', 1.124 + hints: '', 1.125 + markup: 'VVVVVVVVVVVVVVVVVVVVVVVVV', 1.126 + status: 'VALID', 1.127 + message: '', 1.128 + args: { 1.129 + command: { name: 'tsrsrsr' }, 1.130 + p1: { 1.131 + value: 'abc\\ndef', 1.132 + arg: ' abc\\\\ndef', 1.133 + status: 'VALID', 1.134 + message: '' 1.135 + }, 1.136 + p2: { value: 'asd', arg: ' asd', status: 'VALID', message: '' }, 1.137 + p3: { value: 'asd', arg: ' asd', status: 'VALID', message: '' }, 1.138 + } 1.139 + } 1.140 + } 1.141 + ]); 1.142 +}; 1.143 + 1.144 +exports.testBlank = function(options) { 1.145 + return helpers.audit(options, [ 1.146 + { 1.147 + setup: 'tsrsrsr a "" c', 1.148 + check: { 1.149 + input: 'tsrsrsr a "" c', 1.150 + hints: '', 1.151 + markup: 'VVVVVVVVVVVVVV', 1.152 + cursor: 14, 1.153 + current: 'p3', 1.154 + status: 'ERROR', 1.155 + message: '', 1.156 + args: { 1.157 + command: { name: 'tsrsrsr' }, 1.158 + p1: { 1.159 + value: 'a', 1.160 + arg: ' a', 1.161 + status: 'VALID', 1.162 + message: '' 1.163 + }, 1.164 + p2: { 1.165 + value: undefined, 1.166 + arg: ' ""', 1.167 + status: 'INCOMPLETE' 1.168 + }, 1.169 + p3: { 1.170 + value: 'c', 1.171 + arg: ' c', 1.172 + status: 'VALID', 1.173 + message: '' 1.174 + } 1.175 + } 1.176 + } 1.177 + }, 1.178 + { 1.179 + setup: 'tsrsrsr a b ""', 1.180 + check: { 1.181 + input: 'tsrsrsr a b ""', 1.182 + hints: '', 1.183 + markup: 'VVVVVVVVVVVVVV', 1.184 + cursor: 14, 1.185 + current: 'p3', 1.186 + status: 'VALID', 1.187 + message: '', 1.188 + args: { 1.189 + command: { name: 'tsrsrsr' }, 1.190 + p1: { 1.191 + value: 'a', 1.192 + arg: ' a', 1.193 + status:'VALID', 1.194 + message: '' }, 1.195 + p2: { 1.196 + value: 'b', 1.197 + arg: ' b', 1.198 + status: 'VALID', 1.199 + message: '' 1.200 + }, 1.201 + p3: { 1.202 + value: '', 1.203 + arg: ' ""', 1.204 + status: 'VALID', 1.205 + message: '' 1.206 + } 1.207 + } 1.208 + } 1.209 + } 1.210 + ]); 1.211 +}; 1.212 + 1.213 +exports.testBlankWithParam = function(options) { 1.214 + return helpers.audit(options, [ 1.215 + { 1.216 + setup: 'tsrsrsr a --p3', 1.217 + check: { 1.218 + input: 'tsrsrsr a --p3', 1.219 + hints: ' <string> <p2>', 1.220 + markup: 'VVVVVVVVVVVVVVV', 1.221 + cursor: 15, 1.222 + current: 'p3', 1.223 + status: 'ERROR', 1.224 + message: '', 1.225 + args: { 1.226 + command: { name: 'tsrsrsr' }, 1.227 + p1: { value: 'a', arg: ' a', status: 'VALID', message: '' }, 1.228 + p2: { value: undefined, arg: '', status: 'INCOMPLETE' }, 1.229 + p3: { value: '', arg: ' --p3', status: 'VALID', message: '' }, 1.230 + } 1.231 + } 1.232 + }, 1.233 + { 1.234 + setup: 'tsrsrsr a --p3 ', 1.235 + check: { 1.236 + input: 'tsrsrsr a --p3 ', 1.237 + hints: '<string> <p2>', 1.238 + markup: 'VVVVVVVVVVVVVVVV', 1.239 + cursor: 16, 1.240 + current: 'p3', 1.241 + status: 'ERROR', 1.242 + message: '', 1.243 + args: { 1.244 + command: { name: 'tsrsrsr' }, 1.245 + p1: { value: 'a', arg: ' a', status: 'VALID', message: '' }, 1.246 + p2: { value: undefined, arg: '', status: 'INCOMPLETE' }, 1.247 + p3: { value: '', arg: ' --p3 ', status: 'VALID', message: '' }, 1.248 + } 1.249 + } 1.250 + }, 1.251 + { 1.252 + setup: 'tsrsrsr a --p3 "', 1.253 + check: { 1.254 + input: 'tsrsrsr a --p3 "', 1.255 + hints: ' <p2>', 1.256 + markup: 'VVVVVVVVVVVVVVVVV', 1.257 + cursor: 17, 1.258 + current: 'p3', 1.259 + status: 'ERROR', 1.260 + message: '', 1.261 + args: { 1.262 + command: { name: 'tsrsrsr' }, 1.263 + p1: { value: 'a', arg: ' a', status: 'VALID', message: '' }, 1.264 + p2: { value: undefined, arg: '', status: 'INCOMPLETE' }, 1.265 + p3: { value: '', arg: ' --p3 "', status: 'VALID', message: '' }, 1.266 + } 1.267 + } 1.268 + }, 1.269 + { 1.270 + setup: 'tsrsrsr a --p3 ""', 1.271 + check: { 1.272 + input: 'tsrsrsr a --p3 ""', 1.273 + hints: ' <p2>', 1.274 + markup: 'VVVVVVVVVVVVVVVVVV', 1.275 + cursor: 18, 1.276 + current: 'p3', 1.277 + status: 'ERROR', 1.278 + message: '', 1.279 + args: { 1.280 + command: { name: 'tsrsrsr' }, 1.281 + p1: { value: 'a', arg: ' a', status: 'VALID', message: '' }, 1.282 + p2: { value: undefined, arg: '', status: 'INCOMPLETE' }, 1.283 + p3: { value: '', arg: ' --p3 ""', status: 'VALID', message: '' }, 1.284 + } 1.285 + } 1.286 + } 1.287 + ]); 1.288 +};