browser_gcli_context.js 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  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_context.js");
  22. }
  23. // var helpers = require('./helpers');
  24. exports.testBaseline = function (options) {
  25. return helpers.audit(options, [
  26. // These 3 establish a baseline for comparison when we have used the
  27. // context command
  28. {
  29. setup: "ext",
  30. check: {
  31. input: "ext",
  32. hints: " -> context",
  33. markup: "III",
  34. message: "",
  35. predictions: [ "context", "tsn ext", "tsn exte", "tsn exten", "tsn extend" ],
  36. unassigned: [ ],
  37. }
  38. },
  39. {
  40. setup: "ext test",
  41. check: {
  42. input: "ext test",
  43. hints: "",
  44. markup: "IIIVEEEE",
  45. status: "ERROR",
  46. message: "Too many arguments",
  47. unassigned: [ " test" ],
  48. }
  49. },
  50. {
  51. setup: "tsn",
  52. check: {
  53. input: "tsn",
  54. hints: " deep down nested cmd",
  55. markup: "III",
  56. cursor: 3,
  57. current: "__command",
  58. status: "ERROR",
  59. predictionsContains: [ "tsn deep down nested cmd", "tsn ext", "tsn exte" ],
  60. args: {
  61. command: { name: "tsn" },
  62. }
  63. }
  64. }
  65. ]);
  66. };
  67. exports.testContext = function (options) {
  68. return helpers.audit(options, [
  69. // Use the 'tsn' context
  70. {
  71. setup: "context tsn",
  72. check: {
  73. input: "context tsn",
  74. hints: " deep down nested cmd",
  75. markup: "VVVVVVVVVVV",
  76. message: "",
  77. predictionsContains: [ "tsn deep down nested cmd", "tsn ext", "tsn exte" ],
  78. args: {
  79. command: { name: "context" },
  80. prefix: {
  81. value: options.requisition.system.commands.get("tsn"),
  82. status: "VALID",
  83. message: ""
  84. }
  85. }
  86. },
  87. exec: {
  88. output: "Using tsn as a command prefix"
  89. }
  90. },
  91. // For comparison with earlier
  92. {
  93. setup: "ext",
  94. check: {
  95. input: "ext",
  96. hints: " <text>",
  97. markup: "VVV",
  98. predictions: [ "tsn ext", "tsn exte", "tsn exten", "tsn extend" ],
  99. args: {
  100. command: { name: "tsn ext" },
  101. text: {
  102. value: undefined,
  103. arg: "",
  104. status: "INCOMPLETE"
  105. }
  106. }
  107. }
  108. },
  109. {
  110. setup: "ext test",
  111. check: {
  112. input: "ext test",
  113. hints: "",
  114. markup: "VVVVVVVV",
  115. args: {
  116. command: { name: "tsn ext" },
  117. text: {
  118. value: "test",
  119. arg: " test",
  120. status: "VALID",
  121. message: ""
  122. }
  123. }
  124. },
  125. exec: {
  126. output: "Exec: tsnExt text=test"
  127. }
  128. },
  129. {
  130. setup: "tsn",
  131. check: {
  132. input: "tsn",
  133. hints: " deep down nested cmd",
  134. markup: "III",
  135. message: "",
  136. predictionsContains: [ "tsn deep down nested cmd", "tsn ext", "tsn exte" ],
  137. args: {
  138. command: { name: "tsn" },
  139. }
  140. }
  141. },
  142. // Does it actually work?
  143. {
  144. setup: "tsb true",
  145. check: {
  146. input: "tsb true",
  147. hints: "",
  148. markup: "VVVVVVVV",
  149. options: [ "true" ],
  150. message: "",
  151. predictions: [ "true" ],
  152. unassigned: [ ],
  153. args: {
  154. command: { name: "tsb" },
  155. toggle: { value: true, arg: " true", status: "VALID", message: "" }
  156. }
  157. }
  158. },
  159. {
  160. // Bug 866710 - GCLI should allow argument merging for non-string parameters
  161. setup: "context tsn ext",
  162. skip: true
  163. },
  164. {
  165. setup: 'context "tsn ext"',
  166. check: {
  167. input: 'context "tsn ext"',
  168. hints: "",
  169. markup: "VVVVVVVVVVVVVVVVV",
  170. message: "",
  171. predictions: [ "tsn ext", "tsn exte", "tsn exten", "tsn extend" ],
  172. unassigned: [ ],
  173. args: {
  174. command: { name: "context" },
  175. prefix: {
  176. value: options.requisition.system.commands.get("tsn ext"),
  177. status: "VALID",
  178. message: ""
  179. }
  180. }
  181. },
  182. exec: {
  183. output: "Can't use 'tsn ext' as a prefix because it is not a parent command.",
  184. error: true
  185. }
  186. },
  187. /*
  188. {
  189. setup: 'context "tsn deep"',
  190. check: {
  191. input: 'context "tsn deep"',
  192. hints: '',
  193. markup: 'VVVVVVVVVVVVVVVVVV',
  194. status: 'ERROR',
  195. message: '',
  196. predictions: [ 'tsn deep' ],
  197. unassigned: [ ],
  198. args: {
  199. command: { name: 'context' },
  200. prefix: {
  201. value: options.requisition.system.commands.get('tsn deep'),
  202. status: 'VALID',
  203. message: ''
  204. }
  205. }
  206. },
  207. exec: {
  208. output: ''
  209. }
  210. },
  211. */
  212. {
  213. setup: "context",
  214. check: {
  215. input: "context",
  216. hints: " [prefix]",
  217. markup: "VVVVVVV",
  218. status: "VALID",
  219. unassigned: [ ],
  220. args: {
  221. command: { name: "context" },
  222. prefix: { value: undefined, arg: "", status: "VALID", message: "" },
  223. }
  224. },
  225. exec: {
  226. output: "Command prefix is unset",
  227. type: "string",
  228. error: false
  229. }
  230. }
  231. ]);
  232. };