xultestrunner 0.2.9 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (162) hide show
  1. data/.document +5 -0
  2. data/.gitignore +4 -1
  3. data/LICENSE +17 -18
  4. data/README.rdoc +18 -0
  5. data/Rakefile +65 -40
  6. data/VERSION +1 -1
  7. data/bin/xultest +1 -12
  8. data/lib/xultestrunner.rb +1 -1
  9. data/test/test_helper.rb +9 -0
  10. data/test/xultestrunner_test.rb +7 -0
  11. data/xpcomcore/app/application.ini +12 -0
  12. data/xpcomcore/app/chrome/chrome.manifest +1 -0
  13. data/xpcomcore/app/chrome/content/xul/main_window.xul +6 -0
  14. data/xpcomcore/app/components/bootstrapper.js +70 -0
  15. data/xpcomcore/app/defaults/preferences/prefs.js +7 -0
  16. data/xultestrunner.gemspec +21 -150
  17. metadata +27 -153
  18. data/.gitmodules +0 -3
  19. data/README +0 -17
  20. data/xulapp/application.ini +0 -9
  21. data/xulapp/chrome/chrome.manifest +0 -2
  22. data/xulapp/chrome/content/interface/boot.xul +0 -20
  23. data/xulapp/chrome/content/interface/testharness.html +0 -30
  24. data/xulapp/chrome/content/lib/xultestcase.js +0 -140
  25. data/xulapp/chrome/content/lib/xultestrunner.js +0 -120
  26. data/xulapp/chrome/content/vendor/prototype/LICENSE +0 -16
  27. data/xulapp/chrome/content/vendor/prototype/prototype.js +0 -4874
  28. data/xulapp/chrome/content/vendor/scriptaculous/LICENSE +0 -20
  29. data/xulapp/chrome/content/vendor/scriptaculous/test.css +0 -90
  30. data/xulapp/chrome/content/vendor/scriptaculous/unittest.js +0 -566
  31. data/xulapp/chrome/content/vendor/xpcomcore/LICENSE +0 -21
  32. data/xulapp/chrome/content/vendor/xpcomcore/README +0 -27
  33. data/xulapp/chrome/content/vendor/xpcomcore/Rakefile +0 -83
  34. data/xulapp/chrome/content/vendor/xpcomcore/VERSION.yml +0 -5
  35. data/xulapp/chrome/content/vendor/xpcomcore/bootstrapper.js +0 -32
  36. data/xulapp/chrome/content/vendor/xpcomcore/components/XPCOMCore.js +0 -120
  37. data/xulapp/chrome/content/vendor/xpcomcore/doc/files.html +0 -241
  38. data/xulapp/chrome/content/vendor/xpcomcore/doc/index.html +0 -243
  39. data/xulapp/chrome/content/vendor/xpcomcore/doc/symbols/Error.html +0 -256
  40. data/xulapp/chrome/content/vendor/xpcomcore/doc/symbols/Kernel.html +0 -1030
  41. data/xulapp/chrome/content/vendor/xpcomcore/doc/symbols/LoadError.html +0 -319
  42. data/xulapp/chrome/content/vendor/xpcomcore/doc/symbols/SelfConceptError.html +0 -319
  43. data/xulapp/chrome/content/vendor/xpcomcore/doc/symbols/_global_.html +0 -316
  44. data/xulapp/chrome/content/vendor/xpcomcore/doc/symbols/src/lib_file.js.html +0 -53
  45. data/xulapp/chrome/content/vendor/xpcomcore/doc/symbols/src/lib_kernel.js.html +0 -251
  46. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/README.txt +0 -186
  47. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/Chain.js +0 -102
  48. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/Dumper.js +0 -144
  49. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/Hash.js +0 -84
  50. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/Link.js +0 -153
  51. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/Namespace.js +0 -10
  52. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/Opt.js +0 -134
  53. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/Reflection.js +0 -26
  54. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/String.js +0 -93
  55. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/Testrun.js +0 -129
  56. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame.js +0 -33
  57. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/handlers/FOODOC.js +0 -26
  58. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/handlers/XMLDOC/DomReader.js +0 -159
  59. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/handlers/XMLDOC/XMLDoc.js +0 -16
  60. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/handlers/XMLDOC/XMLParse.js +0 -292
  61. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/handlers/XMLDOC.js +0 -26
  62. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/DocComment.js +0 -200
  63. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/DocTag.js +0 -294
  64. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/JsDoc.js +0 -126
  65. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/JsPlate.js +0 -109
  66. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/Lang.js +0 -144
  67. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/Parser.js +0 -145
  68. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/PluginManager.js +0 -33
  69. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/Symbol.js +0 -645
  70. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/SymbolSet.js +0 -241
  71. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/TextStream.js +0 -41
  72. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/Token.js +0 -18
  73. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/TokenReader.js +0 -332
  74. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/TokenStream.js +0 -133
  75. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/Util.js +0 -32
  76. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/Walker.js +0 -474
  77. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC.js +0 -104
  78. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/main.js +0 -111
  79. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/plugins/commentSrcJson.js +0 -20
  80. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/plugins/frameworkPrototype.js +0 -16
  81. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/plugins/functionCall.js +0 -10
  82. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/plugins/publishSrcHilite.js +0 -62
  83. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/plugins/symbolLink.js +0 -10
  84. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/plugins/tagParamConfig.js +0 -31
  85. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/plugins/tagSynonyms.js +0 -43
  86. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/run.js +0 -348
  87. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/t/TestDoc.js +0 -144
  88. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/t/runner.js +0 -13
  89. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/addon.js +0 -24
  90. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/anon_inner.js +0 -14
  91. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/augments.js +0 -31
  92. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/augments2.js +0 -26
  93. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/borrows.js +0 -46
  94. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/borrows2.js +0 -23
  95. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/config.js +0 -22
  96. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/constructs.js +0 -18
  97. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/encoding.js +0 -10
  98. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/encoding_other.js +0 -12
  99. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/event.js +0 -54
  100. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/exports.js +0 -14
  101. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/functions_anon.js +0 -39
  102. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/functions_nested.js +0 -33
  103. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/global.js +0 -13
  104. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/globals.js +0 -25
  105. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/ignore.js +0 -10
  106. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/inner.js +0 -16
  107. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/jsdoc_test.js +0 -477
  108. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/lend.js +0 -33
  109. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/memberof.js +0 -19
  110. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/memberof_constructor.js +0 -17
  111. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/module.js +0 -17
  112. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/name.js +0 -19
  113. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/namespace_nested.js +0 -23
  114. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/nocode.js +0 -13
  115. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/oblit_anon.js +0 -20
  116. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/overview.js +0 -20
  117. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/param_inline.js +0 -37
  118. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/params_optional.js +0 -8
  119. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/prototype.js +0 -17
  120. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/prototype_nested.js +0 -9
  121. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/prototype_oblit.js +0 -13
  122. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/prototype_oblit_constructor.js +0 -24
  123. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/public.js +0 -10
  124. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/scripts/code.js +0 -5
  125. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/scripts/notcode.txt +0 -5
  126. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/shared.js +0 -42
  127. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/shared2.js +0 -2
  128. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/shortcuts.js +0 -22
  129. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/static_this.js +0 -13
  130. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/synonyms.js +0 -31
  131. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/tosource.js +0 -23
  132. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/variable_redefine.js +0 -14
  133. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test.js +0 -325
  134. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/changes.txt +0 -96
  135. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/conf/sample.conf +0 -31
  136. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/java/build.xml +0 -36
  137. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/java/build_1.4.xml +0 -36
  138. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/java/classes/js.jar +0 -0
  139. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/java/src/JsDebugRun.java +0 -21
  140. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/java/src/JsRun.java +0 -21
  141. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/jsdebug.jar +0 -0
  142. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/jsrun.jar +0 -0
  143. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/jsrun.sh +0 -52
  144. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/allclasses.tmpl +0 -17
  145. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/allfiles.tmpl +0 -56
  146. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/class.tmpl +0 -646
  147. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/index.tmpl +0 -39
  148. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/publish.js +0 -200
  149. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/static/default.css +0 -162
  150. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/static/header.html +0 -2
  151. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/static/index.html +0 -19
  152. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/symbol.tmpl +0 -35
  153. data/xulapp/chrome/content/vendor/xpcomcore/lib/file.js +0 -46
  154. data/xulapp/chrome/content/vendor/xpcomcore/lib/kernel.js +0 -244
  155. data/xulapp/chrome/content/vendor/xpcomcore/test/file_test.js +0 -16
  156. data/xulapp/chrome/content/vendor/xpcomcore/test/fixtures/love.js +0 -1
  157. data/xulapp/chrome/content/vendor/xpcomcore/test/fixtures/mad_love.js +0 -1
  158. data/xulapp/chrome/content/vendor/xpcomcore/test/fixtures/mad_world.js +0 -1
  159. data/xulapp/chrome/content/vendor/xpcomcore/test/fixtures/syntax_error.js +0 -1
  160. data/xulapp/chrome/content/vendor/xpcomcore/test/kernel_test.js +0 -88
  161. data/xulapp/components/bootstrap.js +0 -93
  162. data/xulapp/defaults/preferences/prefs.js +0 -14
@@ -1,294 +0,0 @@
1
- if (typeof JSDOC == "undefined") JSDOC = {};
2
-
3
- /**
4
- @constructor
5
- */
6
- JSDOC.DocTag = function(src) {
7
- this.init();
8
- if (typeof src != "undefined") {
9
- this.parse(src);
10
- }
11
- }
12
-
13
- /**
14
- Create and initialize the properties of this.
15
- */
16
- JSDOC.DocTag.prototype.init = function() {
17
- this.title = "";
18
- this.type = "";
19
- this.name = "";
20
- this.isOptional = false;
21
- this.defaultValue = "";
22
- this.desc = "";
23
-
24
- return this;
25
- }
26
-
27
- /**
28
- Populate the properties of this from the given tag src.
29
- @param {string} src
30
- */
31
- JSDOC.DocTag.prototype.parse = function(src) {
32
- if (typeof src != "string") throw "src must be a string not "+(typeof src);
33
-
34
- try {
35
- src = this.nibbleTitle(src);
36
- if (JSDOC.PluginManager) {
37
- JSDOC.PluginManager.run("onDocTagSynonym", this);
38
- }
39
-
40
- src = this.nibbleType(src);
41
-
42
- // only some tags are allowed to have names.
43
- if (this.title == "param" || this.title == "property" || this.title == "config") { // @config is deprecated
44
- src = this.nibbleName(src);
45
- }
46
- }
47
- catch(e) {
48
- if (LOG) LOG.warn(e);
49
- else throw e;
50
- }
51
- this.desc = src; // whatever is left
52
-
53
- // example tags need to have whitespace preserved
54
- if (this.title != "example") this.desc = this.desc.trim();
55
-
56
- if (JSDOC.PluginManager) {
57
- JSDOC.PluginManager.run("onDocTag", this);
58
- }
59
- }
60
-
61
- /**
62
- Automatically called when this is stringified.
63
- */
64
- JSDOC.DocTag.prototype.toString = function() {
65
- return this.desc;
66
- }
67
-
68
- /*t:
69
- plan(1, "testing JSDOC.DocTag#toString");
70
-
71
- var tag = new JSDOC.DocTag("param {object} date A valid date.");
72
- is(""+tag, "A valid date.", "stringifying a tag returns the desc.");
73
- */
74
-
75
- /**
76
- Find and shift off the title of a tag.
77
- @param {string} src
78
- @return src
79
- */
80
- JSDOC.DocTag.prototype.nibbleTitle = function(src) {
81
- if (typeof src != "string") throw "src must be a string not "+(typeof src);
82
-
83
- var parts = src.match(/^\s*(\S+)(?:\s([\s\S]*))?$/);
84
-
85
- if (parts && parts[1]) this.title = parts[1];
86
- if (parts && parts[2]) src = parts[2];
87
- else src = "";
88
-
89
- return src;
90
- }
91
-
92
- /*t:
93
- plan(8, "testing JSDOC.DocTag#nibbleTitle");
94
-
95
- var tag = new JSDOC.DocTag();
96
-
97
- tag.init().nibbleTitle("aTitleGoesHere");
98
- is(tag.title, "aTitleGoesHere", "a title can be found in a single-word string.");
99
-
100
- var src = tag.init().nibbleTitle("aTitleGoesHere and the rest");
101
- is(tag.title, "aTitleGoesHere", "a title can be found in a multi-word string.");
102
- is(src, "and the rest", "the rest is returned when the title is nibbled off.");
103
-
104
- src = tag.init().nibbleTitle("");
105
- is(tag.title, "", "given an empty string the title is empty.");
106
- is(src, "", "the rest is empty when the tag is empty.");
107
-
108
- var src = tag.init().nibbleTitle(" aTitleGoesHere\n a description");
109
- is(tag.title, "aTitleGoesHere", "leading and trailing spaces are not part of the title.");
110
- is(src, " a description", "leading spaces (less one) are part of the description.");
111
-
112
- tag.init().nibbleTitle("a.Title::Goes_Here foo");
113
- is(tag.title, "a.Title::Goes_Here", "titles with punctuation are allowed.");
114
- */
115
-
116
- /**
117
- Find and shift off the type of a tag.
118
- @requires frame/String.js
119
- @param {string} src
120
- @return src
121
- */
122
- JSDOC.DocTag.prototype.nibbleType = function(src) {
123
- if (typeof src != "string") throw "src must be a string not "+(typeof src);
124
-
125
- if (src.match(/^\s*\{/)) {
126
- var typeRange = src.balance("{", "}");
127
- if (typeRange[1] == -1) {
128
- throw "Malformed comment tag ignored. Tag type requires an opening { and a closing }: "+src;
129
- }
130
- this.type = src.substring(typeRange[0]+1, typeRange[1]).trim();
131
- this.type = this.type.replace(/\s*,\s*/g, "|"); // multiples can be separated by , or |
132
- src = src.substring(typeRange[1]+1);
133
- }
134
-
135
- return src;
136
- }
137
-
138
- /*t:
139
- plan(5, "testing JSDOC.DocTag.parser.nibbleType");
140
- requires("../frame/String.js");
141
-
142
- var tag = new JSDOC.DocTag();
143
-
144
- tag.init().nibbleType("{String[]} aliases");
145
- is(tag.type, "String[]", "type can have non-alpha characters.");
146
-
147
- tag.init().nibbleType("{ aTypeGoesHere } etc etc");
148
- is(tag.type, "aTypeGoesHere", "type is trimmed.");
149
-
150
- tag.init().nibbleType("{ oneType, twoType ,\n threeType } etc etc");
151
- is(tag.type, "oneType|twoType|threeType", "multiple types can be separated by commas.");
152
-
153
- var error;
154
- try { tag.init().nibbleType("{widget foo"); }
155
- catch(e) { error = e; }
156
- is(typeof error, "string", "malformed tag type throws error.");
157
- isnt(error.indexOf("Malformed"), -1, "error message tells tag is malformed.");
158
- */
159
-
160
- /**
161
- Find and shift off the name of a tag.
162
- @requires frame/String.js
163
- @param {string} src
164
- @return src
165
- */
166
- JSDOC.DocTag.prototype.nibbleName = function(src) {
167
- if (typeof src != "string") throw "src must be a string not "+(typeof src);
168
-
169
- src = src.trim();
170
-
171
- // is optional?
172
- if (src.charAt(0) == "[") {
173
- var nameRange = src.balance("[", "]");
174
- if (nameRange[1] == -1) {
175
- throw "Malformed comment tag ignored. Tag optional name requires an opening [ and a closing ]: "+src;
176
- }
177
- this.name = src.substring(nameRange[0]+1, nameRange[1]).trim();
178
- this.isOptional = true;
179
-
180
- src = src.substring(nameRange[1]+1);
181
-
182
- // has default value?
183
- var nameAndValue = this.name.split("=");
184
- if (nameAndValue.length) {
185
- this.name = nameAndValue.shift().trim();
186
- this.defaultValue = nameAndValue.join("=");
187
- }
188
- }
189
- else {
190
- var parts = src.match(/^(\S+)(?:\s([\s\S]*))?$/);
191
- if (parts) {
192
- if (parts[1]) this.name = parts[1];
193
- if (parts[2]) src = parts[2].trim();
194
- else src = "";
195
- }
196
- }
197
-
198
- return src;
199
- }
200
-
201
- /*t:
202
- requires("../frame/String.js");
203
- plan(9, "testing JSDOC.DocTag.parser.nibbleName");
204
-
205
- var tag = new JSDOC.DocTag();
206
-
207
- tag.init().nibbleName("[foo] This is a description.");
208
- is(tag.isOptional, true, "isOptional syntax is detected.");
209
- is(tag.name, "foo", "optional param name is found.");
210
-
211
- tag.init().nibbleName("[foo] This is a description.");
212
- is(tag.isOptional, true, "isOptional syntax is detected when no type.");
213
- is(tag.name, "foo", "optional param name is found when no type.");
214
-
215
- tag.init().nibbleName("[foo=7] This is a description.");
216
- is(tag.name, "foo", "optional param name is found when default value.");
217
- is(tag.defaultValue, 7, "optional param default value is found when default value.");
218
-
219
- //tag.init().nibbleName("[foo= a value] This is a description.");
220
- //is(tag.defaultValue, " a value", "optional param default value is found when default value has spaces (issue #112).");
221
-
222
- tag.init().nibbleName("[foo=[]] This is a description.");
223
- is(tag.defaultValue, "[]", "optional param default value is found when default value is [] (issue #95).");
224
-
225
- tag.init().nibbleName("[foo=a=b] This is a description.");
226
- is(tag.name, "foo", "optional param name is found when default value is a=b.");
227
- is(tag.defaultValue, "a=b", "optional param default value is found when default value is a=b.")
228
- */
229
-
230
- /*t:
231
- plan(32, "Testing JSDOC.DocTag.parser.");
232
- requires("../frame/String.js");
233
-
234
- var tag = new JSDOC.DocTag();
235
-
236
- is(typeof tag, "object", "JSDOC.DocTag.parser with an empty string returns an object.");
237
- is(typeof tag.title, "string", "returned object has a string property 'title'.");
238
- is(typeof tag.type, "string", "returned object has a string property 'type'.");
239
- is(typeof tag.name, "string", "returned object has a string property 'name'.");
240
- is(typeof tag.defaultValue, "string", "returned object has a string property 'defaultValue'.");
241
- is(typeof tag.isOptional, "boolean", "returned object has a boolean property 'isOptional'.");
242
- is(typeof tag.desc, "string", "returned object has a string property 'desc'.");
243
-
244
- tag = new JSDOC.DocTag("param {widget} foo");
245
- is(tag.title, "param", "param title is found.");
246
- is(tag.name, "foo", "param name is found when desc is missing.");
247
- is(tag.desc, "", "param desc is empty when missing.");
248
-
249
- tag = new JSDOC.DocTag("param {object} date A valid date.");
250
- is(tag.name, "date", "param name is found with a type.");
251
- is(tag.type, "object", "param type is found.");
252
- is(tag.desc, "A valid date.", "param desc is found with a type.");
253
-
254
- tag = new JSDOC.DocTag("param aName a description goes\n here.");
255
- is(tag.name, "aName", "param name is found without a type.");
256
- is(tag.desc, "a description goes\n here.", "param desc is found without a type.");
257
-
258
- tag = new JSDOC.DocTag("param {widget}");
259
- is(tag.name, "", "param name is empty when it is not given.");
260
-
261
- tag = new JSDOC.DocTag("param {widget} [foo] This is a description.");
262
- is(tag.name, "foo", "optional param name is found.");
263
-
264
- tag = new JSDOC.DocTag("return {aType} This is a description.");
265
- is(tag.type, "aType", "when return tag has no name, type is found.");
266
- is(tag.desc, "This is a description.", "when return tag has no name, desc is found.");
267
-
268
- tag = new JSDOC.DocTag("author Joe Coder <jcoder@example.com>");
269
- is(tag.title, "author", "author tag has a title.");
270
- is(tag.type, "", "the author tag has no type.");
271
- is(tag.name, "", "the author tag has no name.");
272
- is(tag.desc, "Joe Coder <jcoder@example.com>", "author tag has desc.");
273
-
274
- tag = new JSDOC.DocTag("private \t\n ");
275
- is(tag.title, "private", "private tag has a title.");
276
- is(tag.type, "", "the private tag has no type.");
277
- is(tag.name, "", "the private tag has no name.");
278
- is(tag.desc, "", "private tag has no desc.");
279
-
280
- tag = new JSDOC.DocTag("example\n example(code);\n more();");
281
- is(tag.desc, " example(code);\n more();", "leading whitespace (less one) in examples code is preserved.");
282
-
283
- tag = new JSDOC.DocTag("param theName \n");
284
- is(tag.name, "theName", "name only is found.");
285
-
286
- tag = new JSDOC.DocTag("type theDesc \n");
287
- is(tag.desc, "theDesc", "desc only is found.");
288
-
289
- tag = new JSDOC.DocTag("type {theType} \n");
290
- is(tag.type, "theType", "type only is found.");
291
-
292
- tag = new JSDOC.DocTag("");
293
- is(tag.title, "", "title is empty when tag is empty.");
294
- */
@@ -1,126 +0,0 @@
1
- /**
2
- @constructor
3
- @param [opt] Used to override the commandline options. Useful for testing.
4
- @version $Id: JsDoc.js 773 2009-01-24 09:42:04Z micmath $
5
- */
6
- JSDOC.JsDoc = function(/**object*/ opt) {
7
- if (opt) {
8
- JSDOC.opt = opt;
9
- }
10
-
11
- if (JSDOC.opt.h) {
12
- JSDOC.usage();
13
- quit();
14
- }
15
-
16
- // defend against options that are not sane
17
- if (JSDOC.opt._.length == 0) {
18
- LOG.warn("No source files to work on. Nothing to do.");
19
- quit();
20
- }
21
- if (JSDOC.opt.t === true || JSDOC.opt.d === true) {
22
- JSDOC.usage();
23
- }
24
-
25
- if (typeof JSDOC.opt.d == "string") {
26
- if (!JSDOC.opt.d.charAt(JSDOC.opt.d.length-1).match(/[\\\/]/)) {
27
- JSDOC.opt.d = JSDOC.opt.d+"/";
28
- }
29
- LOG.inform("Output directory set to '"+JSDOC.opt.d+"'.");
30
- IO.mkPath(JSDOC.opt.d);
31
- }
32
- if (JSDOC.opt.e) IO.setEncoding(JSDOC.opt.e);
33
-
34
- // the -r option: scan source directories recursively
35
- if (typeof JSDOC.opt.r == "boolean") JSDOC.opt.r = 10;
36
- else if (!isNaN(parseInt(JSDOC.opt.r))) JSDOC.opt.r = parseInt(JSDOC.opt.r);
37
- else JSDOC.opt.r = 1;
38
-
39
- // the -D option: define user variables
40
- var D = {};
41
- if (JSDOC.opt.D) {
42
- for (var i = 0; i < JSDOC.opt.D.length; i++) {
43
- var defineParts = JSDOC.opt.D[i].split(":", 2);
44
- if (defineParts) D[defineParts[0]] = defineParts[1];
45
- }
46
- }
47
- JSDOC.opt.D = D;
48
- // combine any conf file D options with the commandline D options
49
- if (defined(JSDOC.conf)) for (var c in JSDOC.conf.D) {
50
- if (!defined(JSDOC.opt.D[c])) {
51
- JSDOC.opt.D[c] = JSDOC.conf.D[c];
52
- }
53
- }
54
-
55
- // Give plugins a chance to initialize
56
- if (defined(JSDOC.PluginManager)) {
57
- JSDOC.PluginManager.run("onInit", JSDOC.opt);
58
- }
59
-
60
- JSDOC.opt.srcFiles = JSDOC.JsDoc._getSrcFiles();
61
- JSDOC.JsDoc._parseSrcFiles();
62
- JSDOC.JsDoc.symbolSet = JSDOC.Parser.symbols;
63
- }
64
-
65
- /**
66
- Retrieve source file list.
67
- @returns {String[]} The pathnames of the files to be parsed.
68
- */
69
- JSDOC.JsDoc._getSrcFiles = function() {
70
- JSDOC.JsDoc.srcFiles = [];
71
-
72
- var ext = ["js"];
73
- if (JSDOC.opt.x) {
74
- ext = JSDOC.opt.x.split(",").map(function($) {return $.toLowerCase()});
75
- }
76
-
77
- for (var i = 0; i < JSDOC.opt._.length; i++) {
78
- JSDOC.JsDoc.srcFiles = JSDOC.JsDoc.srcFiles.concat(
79
- IO.ls(JSDOC.opt._[i], JSDOC.opt.r).filter(
80
- function($) {
81
- var thisExt = $.split(".").pop().toLowerCase();
82
-
83
- if (JSDOC.opt.E) {
84
- for(var n = 0; n < JSDOC.opt.E.length; n++) {
85
- if ($.match(new RegExp(JSDOC.opt.E[n]))) {
86
- LOG.inform("Excluding " + $);
87
- return false; // if the file matches the regex then it's excluded.
88
- }
89
- }
90
- }
91
-
92
- return (ext.indexOf(thisExt) > -1); // we're only interested in files with certain extensions
93
- }
94
- )
95
- );
96
- }
97
-
98
- return JSDOC.JsDoc.srcFiles;
99
- }
100
-
101
- JSDOC.JsDoc._parseSrcFiles = function() {
102
- JSDOC.Parser.init();
103
- for (var i = 0, l = JSDOC.JsDoc.srcFiles.length; i < l; i++) {
104
- var srcFile = JSDOC.JsDoc.srcFiles[i];
105
-
106
- if (JSDOC.opt.v) LOG.inform("Parsing file: " + srcFile);
107
-
108
- try {
109
- var src = IO.readFile(srcFile);
110
- }
111
- catch(e) {
112
- LOG.warn("Can't read source file '"+srcFile+"': "+e.message);
113
- }
114
-
115
- var tr = new JSDOC.TokenReader();
116
- var ts = new JSDOC.TokenStream(tr.tokenize(new JSDOC.TextStream(src)));
117
-
118
- JSDOC.Parser.parse(ts, srcFile);
119
-
120
- }
121
- JSDOC.Parser.finish();
122
-
123
- if (JSDOC.PluginManager) {
124
- JSDOC.PluginManager.run("onFinishedParsing", JSDOC.Parser.symbols);
125
- }
126
- }
@@ -1,109 +0,0 @@
1
- /**
2
- @constructor
3
- */
4
- JSDOC.JsPlate = function(templateFile) {
5
- if (templateFile) this.template = IO.readFile(templateFile);
6
-
7
- this.templateFile = templateFile;
8
- this.code = "";
9
- this.parse();
10
- }
11
-
12
- JSDOC.JsPlate.prototype.parse = function() {
13
- this.template = this.template.replace(/\{#[\s\S]+?#\}/gi, "");
14
- this.code = "var output=``"+this.template;
15
-
16
- this.code = this.code.replace(
17
- /<for +each="(.+?)" +in="(.+?)" *>/gi,
18
- function (match, eachName, inName) {
19
- return "``;\rvar $"+eachName+"_keys = keys("+inName+");\rfor(var $"+eachName+"_i = 0; $"+eachName+"_i < $"+eachName+"_keys.length; $"+eachName+"_i++) {\rvar $"+eachName+"_last = ($"+eachName+"_i == $"+eachName+"_keys.length-1);\rvar $"+eachName+"_key = $"+eachName+"_keys[$"+eachName+"_i];\rvar "+eachName+" = "+inName+"[$"+eachName+"_key];\routput+=``";
20
- }
21
- );
22
- this.code = this.code.replace(/<if test="(.+?)">/g, "``;\rif ($1) { output+=``");
23
- this.code = this.code.replace(/<elseif test="(.+?)"\s*\/>/g, "``;}\relse if ($1) { output+=``");
24
- this.code = this.code.replace(/<else\s*\/>/g, "``;}\relse { output+=``");
25
- this.code = this.code.replace(/<\/(if|for)>/g, "``;\r};\routput+=``");
26
- this.code = this.code.replace(
27
- /\{\+\s*([\s\S]+?)\s*\+\}/gi,
28
- function (match, code) {
29
- code = code.replace(/"/g, "``"); // prevent qoute-escaping of inline code
30
- code = code.replace(/(\r?\n)/g, " ");
31
- return "``+ ("+code+") +``";
32
- }
33
- );
34
- this.code = this.code.replace(
35
- /\{!\s*([\s\S]+?)\s*!\}/gi,
36
- function (match, code) {
37
- code = code.replace(/"/g, "``"); // prevent qoute-escaping of inline code
38
- code = code.replace(/(\n)/g, " ");
39
- return "``; "+code+";\routput+=``";
40
- }
41
- );
42
- this.code = this.code+"``;";
43
-
44
- this.code = this.code.replace(/(\r?\n)/g, "\\n");
45
- this.code = this.code.replace(/"/g, "\\\"");
46
- this.code = this.code.replace(/``/g, "\"");
47
- }
48
-
49
- JSDOC.JsPlate.prototype.toCode = function() {
50
- return this.code;
51
- }
52
-
53
- JSDOC.JsPlate.keys = function(obj) {
54
- var keys = [];
55
- if (obj.constructor.toString().indexOf("Array") > -1) {
56
- for (var i = 0; i < obj.length; i++) {
57
- keys.push(i);
58
- }
59
- }
60
- else {
61
- for (var i in obj) {
62
- keys.push(i);
63
- }
64
- }
65
- return keys;
66
- };
67
-
68
- JSDOC.JsPlate.values = function(obj) {
69
- var values = [];
70
- if (obj.constructor.toString().indexOf("Array") > -1) {
71
- for (var i = 0; i < obj.length; i++) {
72
- values.push(obj[i]);
73
- }
74
- }
75
- else {
76
- for (var i in obj) {
77
- values.push(obj[i]);
78
- }
79
- }
80
- return values;
81
- };
82
-
83
- JSDOC.JsPlate.prototype.process = function(data, compact) {
84
- var keys = JSDOC.JsPlate.keys;
85
- var values = JSDOC.JsPlate.values;
86
-
87
- try {
88
- eval(this.code);
89
- }
90
- catch (e) {
91
- print(">> There was an error evaluating the compiled code from template: "+this.templateFile);
92
- print(" The error was on line "+e.lineNumber+" "+e.name+": "+e.message);
93
- var lines = this.code.split("\r");
94
- if (e.lineNumber-2 >= 0) print("line "+(e.lineNumber-1)+": "+lines[e.lineNumber-2]);
95
- print("line "+e.lineNumber+": "+lines[e.lineNumber-1]);
96
- print("");
97
- }
98
-
99
- if (compact) { // patch by mcbain.asm
100
- // Remove lines that contain only space-characters, usually left by lines in the template
101
- // which originally only contained JSPlate tags or code. This makes it easier to write
102
- // non-tricky templates which still put out nice code (not bloated with extra lines).
103
- // Lines purposely left blank (just a line ending) are left alone.
104
- output = output.replace(/\s+?(\r?)\n/g, "$1\n");
105
- }
106
-
107
- /*debug*///print(this.code);
108
- return output;
109
- }
@@ -1,144 +0,0 @@
1
- /**
2
- @namespace
3
- */
4
- JSDOC.Lang = {
5
- }
6
-
7
- JSDOC.Lang.isBuiltin = function(name) {
8
- return (JSDOC.Lang.isBuiltin.coreObjects.indexOf(name) > -1);
9
- }
10
- JSDOC.Lang.isBuiltin.coreObjects = ['_global_', 'Array', 'Boolean', 'Date', 'Error', 'Function', 'Math', 'Number', 'Object', 'RegExp', 'String'];
11
-
12
- JSDOC.Lang.whitespace = function(ch) {
13
- return JSDOC.Lang.whitespace.names[ch];
14
- }
15
- JSDOC.Lang.whitespace.names = {
16
- " ": "SPACE",
17
- "\f": "FORMFEED",
18
- "\t": "TAB",
19
- "\u0009": "UNICODE_TAB",
20
- "\u000A": "UNICODE_NBR",
21
- "\u0008": "VERTICAL_TAB"
22
- };
23
-
24
- JSDOC.Lang.newline = function(ch) {
25
- return JSDOC.Lang.newline.names[ch];
26
- }
27
- JSDOC.Lang.newline.names = {
28
- "\n": "NEWLINE",
29
- "\r": "RETURN",
30
- "\u000A": "UNICODE_LF",
31
- "\u000D": "UNICODE_CR",
32
- "\u2029": "UNICODE_PS",
33
- "\u2028": "UNICODE_LS"
34
- };
35
-
36
- JSDOC.Lang.keyword = function(word) {
37
- return JSDOC.Lang.keyword.names["="+word];
38
- }
39
- JSDOC.Lang.keyword.names = {
40
- "=break": "BREAK",
41
- "=case": "CASE",
42
- "=catch": "CATCH",
43
- "=const": "VAR",
44
- "=continue": "CONTINUE",
45
- "=default": "DEFAULT",
46
- "=delete": "DELETE",
47
- "=do": "DO",
48
- "=else": "ELSE",
49
- "=false": "FALSE",
50
- "=finally": "FINALLY",
51
- "=for": "FOR",
52
- "=function": "FUNCTION",
53
- "=if": "IF",
54
- "=in": "IN",
55
- "=instanceof": "INSTANCEOF",
56
- "=new": "NEW",
57
- "=null": "NULL",
58
- "=return": "RETURN",
59
- "=switch": "SWITCH",
60
- "=this": "THIS",
61
- "=throw": "THROW",
62
- "=true": "TRUE",
63
- "=try": "TRY",
64
- "=typeof": "TYPEOF",
65
- "=void": "VOID",
66
- "=while": "WHILE",
67
- "=with": "WITH",
68
- "=var": "VAR"
69
- };
70
-
71
- JSDOC.Lang.punc = function(ch) {
72
- return JSDOC.Lang.punc.names[ch];
73
- }
74
- JSDOC.Lang.punc.names = {
75
- ";": "SEMICOLON",
76
- ",": "COMMA",
77
- "?": "HOOK",
78
- ":": "COLON",
79
- "||": "OR",
80
- "&&": "AND",
81
- "|": "BITWISE_OR",
82
- "^": "BITWISE_XOR",
83
- "&": "BITWISE_AND",
84
- "===": "STRICT_EQ",
85
- "==": "EQ",
86
- "=": "ASSIGN",
87
- "!==": "STRICT_NE",
88
- "!=": "NE",
89
- "<<": "LSH",
90
- "<=": "LE",
91
- "<": "LT",
92
- ">>>": "URSH",
93
- ">>": "RSH",
94
- ">=": "GE",
95
- ">": "GT",
96
- "++": "INCREMENT",
97
- "--": "DECREMENT",
98
- "+": "PLUS",
99
- "-": "MINUS",
100
- "*": "MUL",
101
- "/": "DIV",
102
- "%": "MOD",
103
- "!": "NOT",
104
- "~": "BITWISE_NOT",
105
- ".": "DOT",
106
- "[": "LEFT_BRACKET",
107
- "]": "RIGHT_BRACKET",
108
- "{": "LEFT_CURLY",
109
- "}": "RIGHT_CURLY",
110
- "(": "LEFT_PAREN",
111
- ")": "RIGHT_PAREN"
112
- };
113
-
114
- JSDOC.Lang.matching = function(name) {
115
- return JSDOC.Lang.matching.names[name];
116
- }
117
- JSDOC.Lang.matching.names = {
118
- "LEFT_PAREN": "RIGHT_PAREN",
119
- "RIGHT_PAREN": "LEFT_PAREN",
120
- "LEFT_CURLY": "RIGHT_CURLY",
121
- "RIGHT_CURLY": "LEFT_CURLY",
122
- "LEFT_BRACE": "RIGHT_BRACE",
123
- "RIGHT_BRACE": "LEFT_BRACE"
124
- }
125
-
126
- JSDOC.Lang.isNumber = function(str) {
127
- return /^(\.[0-9]|[0-9]+\.|[0-9])[0-9]*([eE][+-][0-9]+)?$/i.test(str);
128
- }
129
-
130
- JSDOC.Lang.isHexDec = function(str) {
131
- return /^0x[0-9A-F]+$/i.test(str);
132
- }
133
-
134
- JSDOC.Lang.isWordChar = function(str) {
135
- return /^[a-zA-Z0-9$_.]+$/.test(str);
136
- }
137
-
138
- JSDOC.Lang.isSpace = function(str) {
139
- return (typeof JSDOC.Lang.whitespace(str) != "undefined");
140
- }
141
-
142
- JSDOC.Lang.isNewline = function(str) {
143
- return (typeof JSDOC.Lang.newline(str) != "undefined");
144
- }