xultestrunner 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/.gitmodules +3 -0
- data/LICENSE +21 -0
- data/README +17 -0
- data/Rakefile +50 -0
- data/VERSION +1 -0
- data/bin/xultest +13 -0
- data/lib/xultestrunner.rb +1 -0
- data/xulapp/application.ini +9 -0
- data/xulapp/chrome/chrome.manifest +2 -0
- data/xulapp/chrome/content/interface/boot.xul +20 -0
- data/xulapp/chrome/content/interface/testharness.html +30 -0
- data/xulapp/chrome/content/lib/xultestcase.js +140 -0
- data/xulapp/chrome/content/lib/xultestrunner.js +120 -0
- data/xulapp/chrome/content/vendor/prototype/LICENSE +16 -0
- data/xulapp/chrome/content/vendor/prototype/prototype.js +4874 -0
- data/xulapp/chrome/content/vendor/scriptaculous/LICENSE +20 -0
- data/xulapp/chrome/content/vendor/scriptaculous/test.css +90 -0
- data/xulapp/chrome/content/vendor/scriptaculous/unittest.js +566 -0
- data/xulapp/chrome/content/vendor/xpcomcore/LICENSE +21 -0
- data/xulapp/chrome/content/vendor/xpcomcore/README +27 -0
- data/xulapp/chrome/content/vendor/xpcomcore/Rakefile +83 -0
- data/xulapp/chrome/content/vendor/xpcomcore/VERSION.yml +5 -0
- data/xulapp/chrome/content/vendor/xpcomcore/bootstrapper.js +32 -0
- data/xulapp/chrome/content/vendor/xpcomcore/components/XPCOMCore.js +120 -0
- data/xulapp/chrome/content/vendor/xpcomcore/doc/files.html +241 -0
- data/xulapp/chrome/content/vendor/xpcomcore/doc/index.html +243 -0
- data/xulapp/chrome/content/vendor/xpcomcore/doc/symbols/Error.html +256 -0
- data/xulapp/chrome/content/vendor/xpcomcore/doc/symbols/Kernel.html +1030 -0
- data/xulapp/chrome/content/vendor/xpcomcore/doc/symbols/LoadError.html +319 -0
- data/xulapp/chrome/content/vendor/xpcomcore/doc/symbols/SelfConceptError.html +319 -0
- data/xulapp/chrome/content/vendor/xpcomcore/doc/symbols/_global_.html +316 -0
- data/xulapp/chrome/content/vendor/xpcomcore/doc/symbols/src/lib_file.js.html +53 -0
- data/xulapp/chrome/content/vendor/xpcomcore/doc/symbols/src/lib_kernel.js.html +251 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/README.txt +186 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame.js +33 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/Chain.js +102 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/Dumper.js +144 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/Hash.js +84 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/Link.js +153 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/Namespace.js +10 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/Opt.js +134 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/Reflection.js +26 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/String.js +93 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/Testrun.js +129 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/handlers/FOODOC.js +26 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/handlers/XMLDOC.js +26 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/handlers/XMLDOC/DomReader.js +159 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/handlers/XMLDOC/XMLDoc.js +16 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/handlers/XMLDOC/XMLParse.js +292 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC.js +104 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/DocComment.js +200 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/DocTag.js +294 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/JsDoc.js +126 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/JsPlate.js +109 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/Lang.js +144 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/Parser.js +145 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/PluginManager.js +33 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/Symbol.js +645 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/SymbolSet.js +241 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/TextStream.js +41 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/Token.js +18 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/TokenReader.js +332 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/TokenStream.js +133 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/Util.js +32 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/Walker.js +474 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/main.js +111 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/plugins/commentSrcJson.js +20 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/plugins/frameworkPrototype.js +16 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/plugins/functionCall.js +10 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/plugins/publishSrcHilite.js +62 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/plugins/symbolLink.js +10 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/plugins/tagParamConfig.js +31 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/plugins/tagSynonyms.js +43 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/run.js +348 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/t/TestDoc.js +144 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/t/runner.js +13 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test.js +325 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/addon.js +24 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/anon_inner.js +14 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/augments.js +31 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/augments2.js +26 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/borrows.js +46 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/borrows2.js +23 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/config.js +22 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/constructs.js +18 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/encoding.js +10 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/encoding_other.js +12 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/event.js +54 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/exports.js +14 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/functions_anon.js +39 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/functions_nested.js +33 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/global.js +13 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/globals.js +25 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/ignore.js +10 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/inner.js +16 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/jsdoc_test.js +477 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/lend.js +33 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/memberof.js +19 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/memberof_constructor.js +17 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/module.js +17 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/name.js +19 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/namespace_nested.js +23 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/nocode.js +13 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/oblit_anon.js +20 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/overview.js +20 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/param_inline.js +37 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/params_optional.js +8 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/prototype.js +17 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/prototype_nested.js +9 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/prototype_oblit.js +13 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/prototype_oblit_constructor.js +24 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/public.js +10 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/scripts/code.js +5 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/scripts/notcode.txt +5 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/shared.js +42 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/shared2.js +2 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/shortcuts.js +22 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/static_this.js +13 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/synonyms.js +31 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/tosource.js +23 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/variable_redefine.js +14 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/changes.txt +96 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/conf/sample.conf +31 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/java/build.xml +36 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/java/build_1.4.xml +36 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/java/classes/js.jar +0 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/java/src/JsDebugRun.java +21 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/java/src/JsRun.java +21 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/jsdebug.jar +0 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/jsrun.jar +0 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/jsrun.sh +52 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/allclasses.tmpl +17 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/allfiles.tmpl +56 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/class.tmpl +646 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/index.tmpl +39 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/publish.js +200 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/static/default.css +162 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/static/header.html +2 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/static/index.html +19 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/symbol.tmpl +35 -0
- data/xulapp/chrome/content/vendor/xpcomcore/lib/file.js +46 -0
- data/xulapp/chrome/content/vendor/xpcomcore/lib/kernel.js +244 -0
- data/xulapp/chrome/content/vendor/xpcomcore/test/file_test.js +16 -0
- data/xulapp/chrome/content/vendor/xpcomcore/test/fixtures/love.js +1 -0
- data/xulapp/chrome/content/vendor/xpcomcore/test/fixtures/mad_love.js +1 -0
- data/xulapp/chrome/content/vendor/xpcomcore/test/fixtures/mad_world.js +1 -0
- data/xulapp/chrome/content/vendor/xpcomcore/test/fixtures/syntax_error.js +1 -0
- data/xulapp/chrome/content/vendor/xpcomcore/test/kernel_test.js +88 -0
- data/xulapp/components/bootstrap.js +93 -0
- data/xulapp/defaults/preferences/prefs.js +14 -0
- data/xultestrunner.gemspec +190 -0
- metadata +207 -0
@@ -0,0 +1,84 @@
|
|
1
|
+
/**
|
2
|
+
@constructor
|
3
|
+
@example
|
4
|
+
var _index = new Hash();
|
5
|
+
_index.set("a", "apple");
|
6
|
+
_index.set("b", "blue");
|
7
|
+
_index.set("c", "coffee");
|
8
|
+
|
9
|
+
for (var p = _index.first(); p; p = _index.next()) {
|
10
|
+
print(p.key+" is for "+p.value);
|
11
|
+
}
|
12
|
+
|
13
|
+
*/
|
14
|
+
var Hash = function() {
|
15
|
+
this._map = {};
|
16
|
+
this._keys = [];
|
17
|
+
this._vals = [];
|
18
|
+
this.reset();
|
19
|
+
}
|
20
|
+
|
21
|
+
Hash.prototype.set = function(k, v) {
|
22
|
+
if (k != "") {
|
23
|
+
this._keys.push(k);
|
24
|
+
this._map["="+k] = this._vals.length;
|
25
|
+
this._vals.push(v);
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
Hash.prototype.replace = function(k, k2, v) {
|
30
|
+
if (k == k2) return;
|
31
|
+
|
32
|
+
var offset = this._map["="+k];
|
33
|
+
this._keys[offset] = k2;
|
34
|
+
if (typeof v != "undefined") this._vals[offset] = v;
|
35
|
+
this._map["="+k2] = offset;
|
36
|
+
delete(this._map["="+k]);
|
37
|
+
}
|
38
|
+
|
39
|
+
Hash.prototype.drop = function(k) {
|
40
|
+
if (k != "") {
|
41
|
+
var offset = this._map["="+k];
|
42
|
+
this._keys.splice(offset, 1);
|
43
|
+
this._vals.splice(offset, 1);
|
44
|
+
delete(this._map["="+k]);
|
45
|
+
for (var p in this._map) {
|
46
|
+
if (this._map[p] >= offset) this._map[p]--;
|
47
|
+
}
|
48
|
+
if (this._cursor >= offset && this._cursor > 0) this._cursor--;
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
Hash.prototype.get = function(k) {
|
53
|
+
if (k != "") {
|
54
|
+
return this._vals[this._map["="+k]];
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
Hash.prototype.keys = function() {
|
59
|
+
return this._keys;
|
60
|
+
}
|
61
|
+
|
62
|
+
Hash.prototype.hasKey = function(k) {
|
63
|
+
if (k != "") {
|
64
|
+
return (typeof this._map["="+k] != "undefined");
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
Hash.prototype.values = function() {
|
69
|
+
return this._vals;
|
70
|
+
}
|
71
|
+
|
72
|
+
Hash.prototype.reset = function() {
|
73
|
+
this._cursor = 0;
|
74
|
+
}
|
75
|
+
|
76
|
+
Hash.prototype.first = function() {
|
77
|
+
this.reset();
|
78
|
+
return this.next();
|
79
|
+
}
|
80
|
+
|
81
|
+
Hash.prototype.next = function() {
|
82
|
+
if (this._cursor++ < this._keys.length)
|
83
|
+
return {key: this._keys[this._cursor-1], value: this._vals[this._cursor-1]};
|
84
|
+
}
|
@@ -0,0 +1,153 @@
|
|
1
|
+
/** Handle the creation of HTML links to documented symbols.
|
2
|
+
@constructor
|
3
|
+
*/
|
4
|
+
function Link() {
|
5
|
+
this.alias = "";
|
6
|
+
this.src = "";
|
7
|
+
this.file = "";
|
8
|
+
this.text = "";
|
9
|
+
this.innerName = "";
|
10
|
+
this.classLink = false;
|
11
|
+
this.targetName = "";
|
12
|
+
|
13
|
+
this.target = function(targetName) {
|
14
|
+
if (defined(targetName)) this.targetName = targetName;
|
15
|
+
return this;
|
16
|
+
}
|
17
|
+
this.inner = function(inner) {
|
18
|
+
if (defined(inner)) this.innerName = inner;
|
19
|
+
return this;
|
20
|
+
}
|
21
|
+
this.withText = function(text) {
|
22
|
+
if (defined(text)) this.text = text;
|
23
|
+
return this;
|
24
|
+
}
|
25
|
+
this.toSrc = function(filename) {
|
26
|
+
if (defined(filename)) this.src = filename;
|
27
|
+
return this;
|
28
|
+
}
|
29
|
+
this.toSymbol = function(alias) {
|
30
|
+
if (defined(alias)) this.alias = new String(alias);
|
31
|
+
return this;
|
32
|
+
}
|
33
|
+
this.toClass = function(alias) {
|
34
|
+
this.classLink = true;
|
35
|
+
return this.toSymbol(alias);
|
36
|
+
}
|
37
|
+
this.toFile = function(file) {
|
38
|
+
if (defined(file)) this.file = file;
|
39
|
+
return this;
|
40
|
+
}
|
41
|
+
|
42
|
+
this.toString = function() {
|
43
|
+
var linkString;
|
44
|
+
var thisLink = this;
|
45
|
+
|
46
|
+
if (this.alias) {
|
47
|
+
linkString = this.alias.replace(/(^|[^a-z$0-9_#.:^-])([|a-z$0-9_#.:^-]+)($|[^a-z$0-9_#.:^-])/i,
|
48
|
+
function(match, prematch, symbolName, postmatch) {
|
49
|
+
var symbolNames = symbolName.split("|");
|
50
|
+
var links = [];
|
51
|
+
for (var i = 0, l = symbolNames.length; i < l; i++) {
|
52
|
+
thisLink.alias = symbolNames[i];
|
53
|
+
links.push(thisLink._makeSymbolLink(symbolNames[i]));
|
54
|
+
}
|
55
|
+
return prematch+links.join("|")+postmatch;
|
56
|
+
}
|
57
|
+
);
|
58
|
+
}
|
59
|
+
else if (this.src) {
|
60
|
+
linkString = thisLink._makeSrcLink(this.src);
|
61
|
+
}
|
62
|
+
else if (this.file) {
|
63
|
+
linkString = thisLink._makeFileLink(this.file);
|
64
|
+
}
|
65
|
+
|
66
|
+
return linkString;
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
70
|
+
/** prefixed for hashes */
|
71
|
+
Link.hashPrefix = "";
|
72
|
+
|
73
|
+
/** Appended to the front of relative link paths. */
|
74
|
+
Link.base = "";
|
75
|
+
|
76
|
+
Link.symbolNameToLinkName = function(symbol) {
|
77
|
+
var linker = "";
|
78
|
+
if (symbol.isStatic) linker = ".";
|
79
|
+
else if (symbol.isInner) linker = "-";
|
80
|
+
|
81
|
+
return Link.hashPrefix+linker+symbol.name;
|
82
|
+
}
|
83
|
+
|
84
|
+
/** Create a link to another symbol. */
|
85
|
+
Link.prototype._makeSymbolLink = function(alias) {
|
86
|
+
var linkBase = Link.base+publish.conf.symbolsDir;
|
87
|
+
var linkTo = Link.symbolSet.getSymbol(alias);
|
88
|
+
var linkPath;
|
89
|
+
var target = (this.targetName)? " target=\""+this.targetName+"\"" : "";
|
90
|
+
|
91
|
+
// is it an internal link?
|
92
|
+
if (alias.charAt(0) == "#") var linkPath = alias;
|
93
|
+
|
94
|
+
// if there is no symbol by that name just return the name unaltered
|
95
|
+
else if (!linkTo) return this.text || alias;
|
96
|
+
|
97
|
+
// it's a symbol in another file
|
98
|
+
else {
|
99
|
+
if (!linkTo.is("CONSTRUCTOR") && !linkTo.isNamespace) { // it's a method or property
|
100
|
+
if (linkTo.isEvent) {
|
101
|
+
linkPath =
|
102
|
+
(Link.filemap)? Link.filemap[linkTo.memberOf]
|
103
|
+
:
|
104
|
+
escape(linkTo.memberOf) || "_global_";
|
105
|
+
linkPath += publish.conf.ext + "#event:" + Link.symbolNameToLinkName(linkTo);
|
106
|
+
}
|
107
|
+
else {
|
108
|
+
linkPath =
|
109
|
+
(Link.filemap)? Link.filemap[linkTo.memberOf]
|
110
|
+
:
|
111
|
+
escape(linkTo.memberOf) || "_global_";
|
112
|
+
linkPath += publish.conf.ext + "#" + Link.symbolNameToLinkName(linkTo);
|
113
|
+
}
|
114
|
+
}
|
115
|
+
else {
|
116
|
+
linkPath = (Link.filemap)? Link.filemap[linkTo.alias] : escape(linkTo.alias);
|
117
|
+
linkPath += publish.conf.ext;// + (this.classLink? "":"#" + Link.hashPrefix + "constructor");
|
118
|
+
}
|
119
|
+
linkPath = linkBase + linkPath
|
120
|
+
}
|
121
|
+
|
122
|
+
var linkText = this.text || alias;
|
123
|
+
|
124
|
+
var link = {linkPath: linkPath, linkText: linkText, linkInner: (this.innerName? "#"+this.innerName : "")};
|
125
|
+
|
126
|
+
if (typeof JSDOC.PluginManager != "undefined") {
|
127
|
+
JSDOC.PluginManager.run("onSymbolLink", link);
|
128
|
+
}
|
129
|
+
|
130
|
+
return "<a href=\""+link.linkPath+link.linkInner+"\""+target+">"+link.linkText+"</a>";
|
131
|
+
}
|
132
|
+
|
133
|
+
/** Create a link to a source file. */
|
134
|
+
Link.prototype._makeSrcLink = function(srcFilePath) {
|
135
|
+
var target = (this.targetName)? " target=\""+this.targetName+"\"" : "";
|
136
|
+
|
137
|
+
// transform filepath into a filename
|
138
|
+
var srcFile = srcFilePath.replace(/\.\.?[\\\/]/g, "").replace(/[:\\\/]/g, "_");
|
139
|
+
var outFilePath = Link.base + publish.conf.srcDir + srcFile + publish.conf.ext;
|
140
|
+
|
141
|
+
if (!this.text) this.text = FilePath.fileName(srcFilePath);
|
142
|
+
return "<a href=\""+outFilePath+"\""+target+">"+this.text+"</a>";
|
143
|
+
}
|
144
|
+
|
145
|
+
/** Create a link to a source file. */
|
146
|
+
Link.prototype._makeFileLink = function(filePath) {
|
147
|
+
var target = (this.targetName)? " target=\""+this.targetName+"\"" : "";
|
148
|
+
|
149
|
+
var outFilePath = Link.base + filePath;
|
150
|
+
|
151
|
+
if (!this.text) this.text = filePath;
|
152
|
+
return "<a href=\""+outFilePath+"\""+target+">"+this.text+"</a>";
|
153
|
+
}
|
@@ -0,0 +1,134 @@
|
|
1
|
+
/** @namespace */
|
2
|
+
Opt = {
|
3
|
+
/**
|
4
|
+
* Get commandline option values.
|
5
|
+
* @param {Array} args Commandline arguments. Like ["-a=xml", "-b", "--class=new", "--debug"]
|
6
|
+
* @param {object} optNames Map short names to long names. Like {a:"accept", b:"backtrace", c:"class", d:"debug"}.
|
7
|
+
* @return {object} Short names and values. Like {a:"xml", b:true, c:"new", d:true}
|
8
|
+
*/
|
9
|
+
get: function(args, optNames) {
|
10
|
+
var opt = {"_": []}; // the unnamed option allows multiple values
|
11
|
+
for (var i = 0; i < args.length; i++) {
|
12
|
+
var arg = new String(args[i]);
|
13
|
+
var name;
|
14
|
+
var value;
|
15
|
+
if (arg.charAt(0) == "-") {
|
16
|
+
if (arg.charAt(1) == "-") { // it's a longname like --foo
|
17
|
+
arg = arg.substring(2);
|
18
|
+
var m = arg.split("=");
|
19
|
+
name = m.shift();
|
20
|
+
value = m.shift();
|
21
|
+
if (typeof value == "undefined") value = true;
|
22
|
+
|
23
|
+
for (var n in optNames) { // convert it to a shortname
|
24
|
+
if (name == optNames[n]) {
|
25
|
+
name = n;
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
29
|
+
else { // it's a shortname like -f
|
30
|
+
arg = arg.substring(1);
|
31
|
+
var m = arg.split("=");
|
32
|
+
name = m.shift();
|
33
|
+
value = m.shift();
|
34
|
+
if (typeof value == "undefined") value = true;
|
35
|
+
|
36
|
+
for (var n in optNames) { // find the matching key
|
37
|
+
if (name == n || name+'[]' == n) {
|
38
|
+
name = n;
|
39
|
+
break;
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}
|
43
|
+
if (name.match(/(.+)\[\]$/)) { // it's an array type like n[]
|
44
|
+
name = RegExp.$1;
|
45
|
+
if (!opt[name]) opt[name] = [];
|
46
|
+
}
|
47
|
+
|
48
|
+
if (opt[name] && opt[name].push) {
|
49
|
+
opt[name].push(value);
|
50
|
+
}
|
51
|
+
else {
|
52
|
+
opt[name] = value;
|
53
|
+
}
|
54
|
+
}
|
55
|
+
else { // not associated with any optname
|
56
|
+
opt._.push(args[i]);
|
57
|
+
}
|
58
|
+
}
|
59
|
+
return opt;
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
63
|
+
/*t:
|
64
|
+
plan(11, "Testing Opt.");
|
65
|
+
|
66
|
+
is(
|
67
|
+
typeof Opt,
|
68
|
+
"object",
|
69
|
+
"Opt is an object."
|
70
|
+
);
|
71
|
+
|
72
|
+
is(
|
73
|
+
typeof Opt.get,
|
74
|
+
"function",
|
75
|
+
"Opt.get is a function."
|
76
|
+
);
|
77
|
+
|
78
|
+
var optNames = {a:"accept", b:"backtrace", c:"class", d:"debug", "e[]":"exceptions"};
|
79
|
+
var t_options = Opt.get(["-a=xml", "-b", "--class=new", "--debug", "-e=one", "-e=two", "foo", "bar"], optNames);
|
80
|
+
|
81
|
+
is(
|
82
|
+
t_options.a,
|
83
|
+
"xml",
|
84
|
+
"an option defined with a short name can be accessed by its short name."
|
85
|
+
);
|
86
|
+
|
87
|
+
is(
|
88
|
+
t_options.b,
|
89
|
+
true,
|
90
|
+
"an option defined with a short name and no value are true."
|
91
|
+
);
|
92
|
+
|
93
|
+
is(
|
94
|
+
t_options.c,
|
95
|
+
"new",
|
96
|
+
"an option defined with a long name can be accessed by its short name."
|
97
|
+
);
|
98
|
+
|
99
|
+
is(
|
100
|
+
t_options.d,
|
101
|
+
true,
|
102
|
+
"an option defined with a long name and no value are true."
|
103
|
+
);
|
104
|
+
|
105
|
+
is(
|
106
|
+
typeof t_options.e,
|
107
|
+
"object",
|
108
|
+
"an option that can accept multiple values is defined."
|
109
|
+
);
|
110
|
+
|
111
|
+
is(
|
112
|
+
t_options.e.length,
|
113
|
+
2,
|
114
|
+
"an option that can accept multiple values can have more than one value."
|
115
|
+
);
|
116
|
+
|
117
|
+
is(
|
118
|
+
t_options.e[1],
|
119
|
+
"two",
|
120
|
+
"an option that can accept multiple values can be accessed as an array."
|
121
|
+
);
|
122
|
+
|
123
|
+
is(
|
124
|
+
typeof t_options._,
|
125
|
+
"object",
|
126
|
+
"the property '_' is defined for unnamed options."
|
127
|
+
);
|
128
|
+
|
129
|
+
is(
|
130
|
+
t_options._[0],
|
131
|
+
"foo",
|
132
|
+
"the property '_' can be accessed as an array."
|
133
|
+
);
|
134
|
+
*/
|
@@ -0,0 +1,26 @@
|
|
1
|
+
/**@constructor*/
|
2
|
+
function Reflection(obj) {
|
3
|
+
this.obj = obj;
|
4
|
+
}
|
5
|
+
|
6
|
+
Reflection.prototype.getConstructorName = function() {
|
7
|
+
if (this.obj.constructor.name) return this.obj.constructor.name;
|
8
|
+
var src = this.obj.constructor.toSource();
|
9
|
+
var name = src.substring(name.indexOf("function")+8, src.indexOf('(')).replace(/ /g,'');
|
10
|
+
return name;
|
11
|
+
}
|
12
|
+
|
13
|
+
Reflection.prototype.getMethod = function(name) {
|
14
|
+
for (var p in this.obj) {
|
15
|
+
if (p == name && typeof(this.obj[p]) == "function") return this.obj[p];
|
16
|
+
}
|
17
|
+
return null;
|
18
|
+
}
|
19
|
+
|
20
|
+
Reflection.prototype.getParameterNames = function() {
|
21
|
+
var src = this.obj.toSource();
|
22
|
+
src = src.substring(
|
23
|
+
src.indexOf("(", 8)+1, src.indexOf(")")
|
24
|
+
);
|
25
|
+
return src.split(/, ?/);
|
26
|
+
}
|
@@ -0,0 +1,93 @@
|
|
1
|
+
/**
|
2
|
+
@name String
|
3
|
+
@class Additions to the core string object.
|
4
|
+
*/
|
5
|
+
|
6
|
+
/** @author Steven Levithan, released as public domain. */
|
7
|
+
String.prototype.trim = function() {
|
8
|
+
var str = this.replace(/^\s+/, '');
|
9
|
+
for (var i = str.length - 1; i >= 0; i--) {
|
10
|
+
if (/\S/.test(str.charAt(i))) {
|
11
|
+
str = str.substring(0, i + 1);
|
12
|
+
break;
|
13
|
+
}
|
14
|
+
}
|
15
|
+
return str;
|
16
|
+
}
|
17
|
+
/*t:
|
18
|
+
plan(6, "Testing String.prototype.trim.");
|
19
|
+
|
20
|
+
var s = " a bc ".trim();
|
21
|
+
is(s, "a bc", "multiple spaces front and back are trimmed.");
|
22
|
+
|
23
|
+
s = "a bc\n\n".trim();
|
24
|
+
is(s, "a bc", "newlines only in back are trimmed.");
|
25
|
+
|
26
|
+
s = "\ta bc".trim();
|
27
|
+
is(s, "a bc", "tabs only in front are trimmed.");
|
28
|
+
|
29
|
+
s = "\n \t".trim();
|
30
|
+
is(s, "", "an all-space string is trimmed to empty.");
|
31
|
+
|
32
|
+
s = "a b\nc".trim();
|
33
|
+
is(s, "a b\nc", "a string with no spaces in front or back is trimmed to itself.");
|
34
|
+
|
35
|
+
s = "".trim();
|
36
|
+
is(s, "", "an empty string is trimmed to empty.");
|
37
|
+
|
38
|
+
*/
|
39
|
+
|
40
|
+
String.prototype.balance = function(open, close) {
|
41
|
+
var i = 0;
|
42
|
+
while (this.charAt(i) != open) {
|
43
|
+
if (i == this.length) return [-1, -1];
|
44
|
+
i++;
|
45
|
+
}
|
46
|
+
|
47
|
+
var j = i+1;
|
48
|
+
var balance = 1;
|
49
|
+
while (j < this.length) {
|
50
|
+
if (this.charAt(j) == open) balance++;
|
51
|
+
if (this.charAt(j) == close) balance--;
|
52
|
+
if (balance == 0) break;
|
53
|
+
j++;
|
54
|
+
if (j == this.length) return [-1, -1];
|
55
|
+
}
|
56
|
+
|
57
|
+
return [i, j];
|
58
|
+
}
|
59
|
+
/*t:
|
60
|
+
plan(16, "Testing String.prototype.balance.");
|
61
|
+
|
62
|
+
var s = "{abc}".balance("{","}");
|
63
|
+
is(s[0], 0, "opener in first is found.");
|
64
|
+
is(s[1], 4, "closer in last is found.");
|
65
|
+
|
66
|
+
s = "ab{c}de".balance("{","}");
|
67
|
+
is(s[0], 2, "opener in middle is found.");
|
68
|
+
is(s[1], 4, "closer in middle is found.");
|
69
|
+
|
70
|
+
s = "a{b{c}de}f".balance("{","}");
|
71
|
+
is(s[0], 1, "nested opener is found.");
|
72
|
+
is(s[1], 8, "nested closer is found.");
|
73
|
+
|
74
|
+
s = "{}".balance("{","}");
|
75
|
+
is(s[0], 0, "opener with no content is found.");
|
76
|
+
is(s[1], 1, "closer with no content is found.");
|
77
|
+
|
78
|
+
s = "".balance("{","}");
|
79
|
+
is(s[0], -1, "empty string opener is -1.");
|
80
|
+
is(s[1], -1, "empty string closer is -1.");
|
81
|
+
|
82
|
+
s = "{abc".balance("{","}");
|
83
|
+
is(s[0], -1, "opener with no closer returns -1.");
|
84
|
+
is(s[1], -1, "no closer returns -1.");
|
85
|
+
|
86
|
+
s = "abc".balance("{","}");
|
87
|
+
is(s[0], -1, "no opener or closer returns -1 for opener.");
|
88
|
+
is(s[1], -1, "no opener or closer returns -1 for closer.");
|
89
|
+
|
90
|
+
s = "a<bc}de".balance("<","}");
|
91
|
+
is(s[0], 1, "unmatching opener is found.");
|
92
|
+
is(s[1], 4, "unmatching closer is found.");
|
93
|
+
*/
|