browser_gcli_string.js 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. /*
  2. * Copyright 2012, Mozilla Foundation and contributors
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. "use strict";
  17. // THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT
  18. // PLEASE TALK TO SOMEONE IN DEVELOPER TOOLS BEFORE EDITING IT
  19. const exports = {};
  20. function test() {
  21. helpers.runTestModule(exports, "browser_gcli_string.js");
  22. }
  23. // var helpers = require('./helpers');
  24. exports.testNewLine = function (options) {
  25. return helpers.audit(options, [
  26. {
  27. setup: "echo a\\nb",
  28. check: {
  29. input: "echo a\\nb",
  30. hints: "",
  31. markup: "VVVVVVVVV",
  32. cursor: 9,
  33. current: "message",
  34. status: "VALID",
  35. args: {
  36. command: { name: "echo" },
  37. message: {
  38. value: "a\nb",
  39. arg: " a\\nb",
  40. status: "VALID",
  41. message: ""
  42. }
  43. }
  44. }
  45. }
  46. ]);
  47. };
  48. exports.testTab = function (options) {
  49. return helpers.audit(options, [
  50. {
  51. setup: "echo a\\tb",
  52. check: {
  53. input: "echo a\\tb",
  54. hints: "",
  55. markup: "VVVVVVVVV",
  56. cursor: 9,
  57. current: "message",
  58. status: "VALID",
  59. args: {
  60. command: { name: "echo" },
  61. message: {
  62. value: "a\tb",
  63. arg: " a\\tb",
  64. status: "VALID",
  65. message: ""
  66. }
  67. }
  68. }
  69. }
  70. ]);
  71. };
  72. exports.testEscape = function (options) {
  73. return helpers.audit(options, [
  74. {
  75. // What's typed is actually:
  76. // tsrsrsr a\\ b c
  77. setup: "tsrsrsr a\\\\ b c",
  78. check: {
  79. input: "tsrsrsr a\\\\ b c",
  80. hints: "",
  81. markup: "VVVVVVVVVVVVVVV",
  82. status: "VALID",
  83. message: "",
  84. args: {
  85. command: { name: "tsrsrsr" },
  86. p1: { value: "a\\", arg: " a\\\\", status: "VALID", message: "" },
  87. p2: { value: "b", arg: " b", status: "VALID", message: "" },
  88. p3: { value: "c", arg: " c", status: "VALID", message: "" },
  89. }
  90. }
  91. },
  92. {
  93. // What's typed is actually:
  94. // tsrsrsr abc\\ndef asd asd
  95. setup: "tsrsrsr abc\\\\ndef asd asd",
  96. check: {
  97. input: "tsrsrsr abc\\\\ndef asd asd",
  98. hints: "",
  99. markup: "VVVVVVVVVVVVVVVVVVVVVVVVV",
  100. status: "VALID",
  101. message: "",
  102. args: {
  103. command: { name: "tsrsrsr" },
  104. p1: {
  105. value: "abc\\ndef",
  106. arg: " abc\\\\ndef",
  107. status: "VALID",
  108. message: ""
  109. },
  110. p2: { value: "asd", arg: " asd", status: "VALID", message: "" },
  111. p3: { value: "asd", arg: " asd", status: "VALID", message: "" },
  112. }
  113. }
  114. }
  115. ]);
  116. };
  117. exports.testBlank = function (options) {
  118. return helpers.audit(options, [
  119. {
  120. setup: 'tsrsrsr a "" c',
  121. check: {
  122. input: 'tsrsrsr a "" c',
  123. hints: "",
  124. markup: "VVVVVVVVVVVVVV",
  125. cursor: 14,
  126. current: "p3",
  127. status: "ERROR",
  128. message: "",
  129. args: {
  130. command: { name: "tsrsrsr" },
  131. p1: {
  132. value: "a",
  133. arg: " a",
  134. status: "VALID",
  135. message: ""
  136. },
  137. p2: {
  138. value: undefined,
  139. arg: ' ""',
  140. status: "INCOMPLETE"
  141. },
  142. p3: {
  143. value: "c",
  144. arg: " c",
  145. status: "VALID",
  146. message: ""
  147. }
  148. }
  149. }
  150. },
  151. {
  152. setup: 'tsrsrsr a b ""',
  153. check: {
  154. input: 'tsrsrsr a b ""',
  155. hints: "",
  156. markup: "VVVVVVVVVVVVVV",
  157. cursor: 14,
  158. current: "p3",
  159. status: "VALID",
  160. message: "",
  161. args: {
  162. command: { name: "tsrsrsr" },
  163. p1: {
  164. value: "a",
  165. arg: " a",
  166. status:"VALID",
  167. message: "" },
  168. p2: {
  169. value: "b",
  170. arg: " b",
  171. status: "VALID",
  172. message: ""
  173. },
  174. p3: {
  175. value: "",
  176. arg: ' ""',
  177. status: "VALID",
  178. message: ""
  179. }
  180. }
  181. }
  182. }
  183. ]);
  184. };
  185. exports.testBlankWithParam = function (options) {
  186. return helpers.audit(options, [
  187. {
  188. setup: "tsrsrsr a --p3",
  189. check: {
  190. input: "tsrsrsr a --p3",
  191. hints: " <string> <p2>",
  192. markup: "VVVVVVVVVVVVVVV",
  193. cursor: 15,
  194. current: "p3",
  195. status: "ERROR",
  196. message: "",
  197. args: {
  198. command: { name: "tsrsrsr" },
  199. p1: { value: "a", arg: " a", status: "VALID", message: "" },
  200. p2: { value: undefined, arg: "", status: "INCOMPLETE" },
  201. p3: { value: "", arg: " --p3", status: "VALID", message: "" },
  202. }
  203. }
  204. },
  205. {
  206. setup: "tsrsrsr a --p3 ",
  207. check: {
  208. input: "tsrsrsr a --p3 ",
  209. hints: "<string> <p2>",
  210. markup: "VVVVVVVVVVVVVVVV",
  211. cursor: 16,
  212. current: "p3",
  213. status: "ERROR",
  214. message: "",
  215. args: {
  216. command: { name: "tsrsrsr" },
  217. p1: { value: "a", arg: " a", status: "VALID", message: "" },
  218. p2: { value: undefined, arg: "", status: "INCOMPLETE" },
  219. p3: { value: "", arg: " --p3 ", status: "VALID", message: "" },
  220. }
  221. }
  222. },
  223. {
  224. setup: 'tsrsrsr a --p3 "',
  225. check: {
  226. input: 'tsrsrsr a --p3 "',
  227. hints: " <p2>",
  228. markup: "VVVVVVVVVVVVVVVVV",
  229. cursor: 17,
  230. current: "p3",
  231. status: "ERROR",
  232. message: "",
  233. args: {
  234. command: { name: "tsrsrsr" },
  235. p1: { value: "a", arg: " a", status: "VALID", message: "" },
  236. p2: { value: undefined, arg: "", status: "INCOMPLETE" },
  237. p3: { value: "", arg: ' --p3 "', status: "VALID", message: "" },
  238. }
  239. }
  240. },
  241. {
  242. setup: 'tsrsrsr a --p3 ""',
  243. check: {
  244. input: 'tsrsrsr a --p3 ""',
  245. hints: " <p2>",
  246. markup: "VVVVVVVVVVVVVVVVVV",
  247. cursor: 18,
  248. current: "p3",
  249. status: "ERROR",
  250. message: "",
  251. args: {
  252. command: { name: "tsrsrsr" },
  253. p1: { value: "a", arg: " a", status: "VALID", message: "" },
  254. p2: { value: undefined, arg: "", status: "INCOMPLETE" },
  255. p3: { value: "", arg: ' --p3 ""', status: "VALID", message: "" },
  256. }
  257. }
  258. }
  259. ]);
  260. };