sproutcore 1.6.0.rc.1-x86-mingw32 → 1.6.0.rc.2-x86-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +31 -6
- data/{History.txt → History.rdoc} +0 -0
- data/{README.txt → README.rdoc} +3 -2
- data/Rakefile +15 -15
- data/{Todo.txt → Todo.rdoc} +0 -0
- data/VERSION.yml +1 -1
- data/lib/buildtasks/manifest.rake +11 -4
- data/lib/buildtasks/target.rake +20 -23
- data/lib/frameworks/sproutcore/CHANGELOG.md +36 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/core.js +2 -42
- data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/handlebars/bind.js +2 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/handlebars/collection.js +3 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/template_helpers/checkbox_support.js +5 -5
- data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/template_helpers/text_field_support.js +29 -12
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/event.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/mixins/template_helpers/text_field_support.js +9 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/collection.js +110 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template_collection.js +63 -26
- data/lib/frameworks/sproutcore/frameworks/datastore/system/child_array.js +25 -5
- data/lib/frameworks/sproutcore/frameworks/datastore/system/record_array.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array.js +26 -3
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/core_methods.js +74 -53
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/alert.js +6 -7
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/picker.js +6 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/alert/ui.js +25 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/tab/methods.js +1 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/tab/ui.js +20 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/select_field.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/tab.js +46 -49
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/container/ui.js +23 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/views/container.js +14 -2
- data/lib/frameworks/sproutcore/frameworks/jquery/jquery-buffered.js +2 -76
- data/lib/frameworks/sproutcore/frameworks/jquery/jquery.js +3348 -1591
- data/lib/frameworks/sproutcore/frameworks/runtime/core.js +25 -5
- data/lib/frameworks/sproutcore/frameworks/runtime/system/index_set.js +0 -3
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/objectForPropertyPath.js +10 -5
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/requiredObjectForPropertyPath.js +29 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/private/observer_queue.js +98 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/list_item.css +2 -2
- data/lib/frameworks/sproutcore/themes/ace/resources/split/split.css +1 -1
- data/lib/gen/language/Buildfile +1 -1
- data/lib/sproutcore.rb +1 -14
- data/lib/sproutcore/buildfile/string_ext.rb +0 -4
- data/lib/sproutcore/helpers/cssmin.rb +44 -59
- data/lib/sproutcore/helpers/text_helper.rb +11 -13
- data/lib/sproutcore/models/manifest.rb +4 -4
- data/lib/sproutcore/models/target.rb +11 -110
- data/lib/sproutcore/rack.rb +0 -1
- data/lib/sproutcore/rack/dev.rb +0 -1
- data/lib/sproutcore/rack/proxy.rb +9 -8
- data/lib/sproutcore/rack/service.rb +1 -1
- data/lib/sproutcore/render_engines/haml.rb +2 -5
- data/lib/sproutcore/tools/build.rb +2 -0
- data/lib/sproutcore/tools/docs.rb +7 -36
- data/lib/sproutcore/tools/manifest.rb +1 -1
- data/spec/buildtasks/target_spec.rb +9 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/Buildfile +1 -1
- data/sproutcore.gemspec +3 -4
- data/vendor/chance/lib/chance/instance.rb +5 -8
- metadata +41 -207
- data/lib/doc_templates/jsdoc/allclasses.tmpl +0 -17
- data/lib/doc_templates/jsdoc/allfiles.tmpl +0 -56
- data/lib/doc_templates/jsdoc/class.tmpl +0 -487
- data/lib/doc_templates/jsdoc/index.tmpl +0 -38
- data/lib/doc_templates/jsdoc/publish.js +0 -170
- data/lib/doc_templates/jsdoc/static/default.css +0 -162
- data/lib/doc_templates/jsdoc/static/header.html +0 -2
- data/lib/doc_templates/jsdoc/static/index.html +0 -19
- data/lib/doc_templates/jsdoc/symbol.tmpl +0 -35
- data/lib/doc_templates/sproutcore/allclasses.tmpl +0 -0
- data/lib/doc_templates/sproutcore/allfiles.tmpl +0 -56
- data/lib/doc_templates/sproutcore/class.tmpl +0 -674
- data/lib/doc_templates/sproutcore/classes-json.tmpl +0 -55
- data/lib/doc_templates/sproutcore/index.tmpl +0 -62
- data/lib/doc_templates/sproutcore/publish.js +0 -346
- data/lib/doc_templates/sproutcore/static/default.css +0 -258
- data/lib/doc_templates/sproutcore/static/header.html +0 -2
- data/lib/doc_templates/sproutcore/static/index.html +0 -19
- data/lib/doc_templates/sproutcore/symbol.tmpl +0 -35
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/private/observer_queue/isObservingSuspended.js +0 -55
- data/lib/sproutcore/rack/docs.rb +0 -24
- data/spec/fixtures/real_world/frameworks/sproutcore/apps/docs/PLACEHOLDER +0 -0
- data/vendor/jsdoc/README.txt +0 -151
- data/vendor/jsdoc/app/frame.js +0 -33
- data/vendor/jsdoc/app/frame/Chain.js +0 -102
- data/vendor/jsdoc/app/frame/Dumper.js +0 -144
- data/vendor/jsdoc/app/frame/Hash.js +0 -47
- data/vendor/jsdoc/app/frame/Link.js +0 -142
- data/vendor/jsdoc/app/frame/Namespace.js +0 -10
- data/vendor/jsdoc/app/frame/Opt.js +0 -134
- data/vendor/jsdoc/app/frame/Reflection.js +0 -26
- data/vendor/jsdoc/app/frame/String.js +0 -93
- data/vendor/jsdoc/app/frame/Testrun.js +0 -129
- data/vendor/jsdoc/app/handlers/FOODOC.js +0 -26
- data/vendor/jsdoc/app/handlers/XMLDOC.js +0 -26
- data/vendor/jsdoc/app/handlers/XMLDOC/DomReader.js +0 -159
- data/vendor/jsdoc/app/handlers/XMLDOC/XMLDoc.js +0 -16
- data/vendor/jsdoc/app/handlers/XMLDOC/XMLParse.js +0 -292
- data/vendor/jsdoc/app/lib/JSDOC.js +0 -98
- data/vendor/jsdoc/app/lib/JSDOC/DocComment.js +0 -200
- data/vendor/jsdoc/app/lib/JSDOC/DocTag.js +0 -294
- data/vendor/jsdoc/app/lib/JSDOC/JsDoc.js +0 -162
- data/vendor/jsdoc/app/lib/JSDOC/JsPlate.js +0 -100
- data/vendor/jsdoc/app/lib/JSDOC/Lang.js +0 -144
- data/vendor/jsdoc/app/lib/JSDOC/Parser.js +0 -109
- data/vendor/jsdoc/app/lib/JSDOC/PluginManager.js +0 -33
- data/vendor/jsdoc/app/lib/JSDOC/Symbol.js +0 -681
- data/vendor/jsdoc/app/lib/JSDOC/SymbolSet.js +0 -226
- data/vendor/jsdoc/app/lib/JSDOC/TextStream.js +0 -41
- data/vendor/jsdoc/app/lib/JSDOC/Token.js +0 -18
- data/vendor/jsdoc/app/lib/JSDOC/TokenReader.js +0 -332
- data/vendor/jsdoc/app/lib/JSDOC/TokenStream.js +0 -133
- data/vendor/jsdoc/app/lib/JSDOC/Util.js +0 -32
- data/vendor/jsdoc/app/lib/JSDOC/Walker.js +0 -453
- data/vendor/jsdoc/app/main.js +0 -74
- data/vendor/jsdoc/app/plugins/commentSrcJson.js +0 -19
- data/vendor/jsdoc/app/plugins/frameworkPrototype.js +0 -16
- data/vendor/jsdoc/app/plugins/functionCall.js +0 -10
- data/vendor/jsdoc/app/plugins/publishSrcHilite.js +0 -62
- data/vendor/jsdoc/app/plugins/sproutcoreTags.js +0 -26
- data/vendor/jsdoc/app/plugins/symbolLink.js +0 -9
- data/vendor/jsdoc/app/plugins/tagParamConfig.js +0 -31
- data/vendor/jsdoc/app/plugins/tagSynonyms.js +0 -43
- data/vendor/jsdoc/app/run.js +0 -346
- data/vendor/jsdoc/app/t/TestDoc.js +0 -144
- data/vendor/jsdoc/app/t/runner.js +0 -13
- data/vendor/jsdoc/app/test.js +0 -304
- data/vendor/jsdoc/app/test/addon.js +0 -24
- data/vendor/jsdoc/app/test/anon_inner.js +0 -14
- data/vendor/jsdoc/app/test/augments.js +0 -31
- data/vendor/jsdoc/app/test/augments2.js +0 -26
- data/vendor/jsdoc/app/test/borrows.js +0 -41
- data/vendor/jsdoc/app/test/borrows2.js +0 -23
- data/vendor/jsdoc/app/test/config.js +0 -22
- data/vendor/jsdoc/app/test/constructs.js +0 -18
- data/vendor/jsdoc/app/test/encoding.js +0 -10
- data/vendor/jsdoc/app/test/encoding_other.js +0 -12
- data/vendor/jsdoc/app/test/functions_anon.js +0 -39
- data/vendor/jsdoc/app/test/functions_nested.js +0 -33
- data/vendor/jsdoc/app/test/global.js +0 -13
- data/vendor/jsdoc/app/test/globals.js +0 -25
- data/vendor/jsdoc/app/test/ignore.js +0 -10
- data/vendor/jsdoc/app/test/inner.js +0 -16
- data/vendor/jsdoc/app/test/jsdoc_test.js +0 -477
- data/vendor/jsdoc/app/test/lend.js +0 -33
- data/vendor/jsdoc/app/test/memberof.js +0 -20
- data/vendor/jsdoc/app/test/memberof_constructor.js +0 -15
- data/vendor/jsdoc/app/test/name.js +0 -19
- data/vendor/jsdoc/app/test/namespace_nested.js +0 -23
- data/vendor/jsdoc/app/test/nocode.js +0 -13
- data/vendor/jsdoc/app/test/oblit_anon.js +0 -20
- data/vendor/jsdoc/app/test/overview.js +0 -20
- data/vendor/jsdoc/app/test/param_inline.js +0 -37
- data/vendor/jsdoc/app/test/params_optional.js +0 -8
- data/vendor/jsdoc/app/test/prototype.js +0 -17
- data/vendor/jsdoc/app/test/prototype_nested.js +0 -9
- data/vendor/jsdoc/app/test/prototype_oblit.js +0 -13
- data/vendor/jsdoc/app/test/prototype_oblit_constructor.js +0 -24
- data/vendor/jsdoc/app/test/public.js +0 -10
- data/vendor/jsdoc/app/test/shared.js +0 -42
- data/vendor/jsdoc/app/test/shared2.js +0 -2
- data/vendor/jsdoc/app/test/shortcuts.js +0 -22
- data/vendor/jsdoc/app/test/static_this.js +0 -13
- data/vendor/jsdoc/app/test/synonyms.js +0 -23
- data/vendor/jsdoc/app/test/tosource.js +0 -23
- data/vendor/jsdoc/app/test/variable_redefine.js +0 -14
- data/vendor/jsdoc/changes.txt +0 -47
- data/vendor/jsdoc/conf/sample.conf +0 -31
- data/vendor/jsdoc/java/build.xml +0 -36
- data/vendor/jsdoc/java/build_1.4.xml +0 -36
- data/vendor/jsdoc/java/classes/js.jar +0 -0
- data/vendor/jsdoc/java/src/JsDebugRun.java +0 -21
- data/vendor/jsdoc/java/src/JsRun.java +0 -21
- data/vendor/jsdoc/jsdebug.jar +0 -0
- data/vendor/jsdoc/jsrun.jar +0 -0
- data/vendor/jsdoc/t/TestDoc.js +0 -144
- data/vendor/jsdoc/t/runner.js +0 -13
- data/vendor/jsdoc/test.js +0 -304
- data/vendor/jsdoc/test/addon.js +0 -24
- data/vendor/jsdoc/test/anon_inner.js +0 -14
- data/vendor/jsdoc/test/augments.js +0 -31
- data/vendor/jsdoc/test/augments2.js +0 -26
- data/vendor/jsdoc/test/borrows.js +0 -41
- data/vendor/jsdoc/test/borrows2.js +0 -23
- data/vendor/jsdoc/test/config.js +0 -22
- data/vendor/jsdoc/test/constructs.js +0 -18
- data/vendor/jsdoc/test/encoding.js +0 -10
- data/vendor/jsdoc/test/encoding_other.js +0 -12
- data/vendor/jsdoc/test/functions_anon.js +0 -39
- data/vendor/jsdoc/test/functions_nested.js +0 -33
- data/vendor/jsdoc/test/global.js +0 -13
- data/vendor/jsdoc/test/globals.js +0 -25
- data/vendor/jsdoc/test/ignore.js +0 -10
- data/vendor/jsdoc/test/inner.js +0 -16
- data/vendor/jsdoc/test/jsdoc_test.js +0 -477
- data/vendor/jsdoc/test/lend.js +0 -33
- data/vendor/jsdoc/test/memberof.js +0 -20
- data/vendor/jsdoc/test/memberof_constructor.js +0 -15
- data/vendor/jsdoc/test/name.js +0 -19
- data/vendor/jsdoc/test/namespace_nested.js +0 -23
- data/vendor/jsdoc/test/nocode.js +0 -13
- data/vendor/jsdoc/test/oblit_anon.js +0 -20
- data/vendor/jsdoc/test/overview.js +0 -20
- data/vendor/jsdoc/test/param_inline.js +0 -37
- data/vendor/jsdoc/test/params_optional.js +0 -8
- data/vendor/jsdoc/test/prototype.js +0 -17
- data/vendor/jsdoc/test/prototype_nested.js +0 -9
- data/vendor/jsdoc/test/prototype_oblit.js +0 -13
- data/vendor/jsdoc/test/prototype_oblit_constructor.js +0 -24
- data/vendor/jsdoc/test/public.js +0 -10
- data/vendor/jsdoc/test/shared.js +0 -42
- data/vendor/jsdoc/test/shared2.js +0 -2
- data/vendor/jsdoc/test/shortcuts.js +0 -22
- data/vendor/jsdoc/test/static_this.js +0 -13
- data/vendor/jsdoc/test/synonyms.js +0 -23
- data/vendor/jsdoc/test/tosource.js +0 -23
- data/vendor/jsdoc/test/variable_redefine.js +0 -14
@@ -1,134 +0,0 @@
|
|
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
|
-
*/
|
@@ -1,26 +0,0 @@
|
|
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
|
-
}
|
@@ -1,93 +0,0 @@
|
|
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
|
-
*/
|
@@ -1,129 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @fileOverview
|
3
|
-
* @name JsTestrun
|
4
|
-
* @author Michael Mathews micmath@gmail.com
|
5
|
-
* @url $HeadURL: https://jsdoc-toolkit.googlecode.com/svn/tags/jsdoc_toolkit-2.0.2/jsdoc-toolkit/app/frame/Testrun.js $
|
6
|
-
* @revision $Id: Testrun.js 418 2008-01-15 21:40:33Z micmath $
|
7
|
-
* @license <a href="http://en.wikipedia.org/wiki/MIT_License">X11/MIT License</a>
|
8
|
-
* (See the accompanying README file for full details.)
|
9
|
-
*/
|
10
|
-
|
11
|
-
/**
|
12
|
-
Yet another unit testing tool for JavaScript.
|
13
|
-
@author Michael Mathews <a href="mailto:micmath@gmail.com">micmath@gmail.com</a>
|
14
|
-
@param {object} testCases Properties are testcase names, values are functions to execute as tests.
|
15
|
-
*/
|
16
|
-
function testrun(testCases) {
|
17
|
-
var ran = 0;
|
18
|
-
for (t in testCases) {
|
19
|
-
var result = testCases[t]();
|
20
|
-
ran++;
|
21
|
-
}
|
22
|
-
|
23
|
-
return testrun.reportOut+"-------------------------------\n"+((testrun.fails>0)? ":( Failed "+testrun.fails+"/" : ":) Passed all ")+testrun.count+" test"+((testrun.count == 1)? "":"s")+".\n";
|
24
|
-
}
|
25
|
-
|
26
|
-
|
27
|
-
testrun.count = 0;
|
28
|
-
testrun.current = null;
|
29
|
-
testrun.passes = 0;
|
30
|
-
testrun.fails = 0;
|
31
|
-
testrun.reportOut = "";
|
32
|
-
|
33
|
-
/** @private */
|
34
|
-
testrun.report = function(text) {
|
35
|
-
testrun.reportOut += text+"\n";
|
36
|
-
}
|
37
|
-
|
38
|
-
/**
|
39
|
-
Check if test evaluates to true.
|
40
|
-
@param {string} test To be evaluated.
|
41
|
-
@param {string} message Optional. To be displayed in the report.
|
42
|
-
@return {boolean} True if the string test evaluates to true.
|
43
|
-
*/
|
44
|
-
ok = function(test, message) {
|
45
|
-
testrun.count++;
|
46
|
-
|
47
|
-
var result;
|
48
|
-
try {
|
49
|
-
result = eval(test);
|
50
|
-
|
51
|
-
if (result) {
|
52
|
-
testrun.passes++;
|
53
|
-
testrun.report(" OK "+testrun.count+" - "+((message != null)? message : ""));
|
54
|
-
}
|
55
|
-
else {
|
56
|
-
testrun.fails++;
|
57
|
-
testrun.report("NOT OK "+testrun.count+" - "+((message != null)? message : ""));
|
58
|
-
}
|
59
|
-
}
|
60
|
-
catch(e) {
|
61
|
-
testrun.fails++
|
62
|
-
testrun.report("NOT OK "+testrun.count+" - "+((message != null)? message : ""));
|
63
|
-
|
64
|
-
}
|
65
|
-
}
|
66
|
-
|
67
|
-
/**
|
68
|
-
Check if test is same as expected.
|
69
|
-
@param {string} test To be evaluated.
|
70
|
-
@param {string} expected
|
71
|
-
@param {string} message Optional. To be displayed in the report.
|
72
|
-
@return {boolean} True if (test == expected). Note that the comparison is not a strict equality check.
|
73
|
-
*/
|
74
|
-
is = function(test, expected, message) {
|
75
|
-
testrun.count++;
|
76
|
-
|
77
|
-
var result;
|
78
|
-
try {
|
79
|
-
result = eval(test);
|
80
|
-
|
81
|
-
if (result == expected) {
|
82
|
-
testrun.passes++
|
83
|
-
testrun.report(" OK "+testrun.count+" - "+((message != null)? message : ""));
|
84
|
-
}
|
85
|
-
else {
|
86
|
-
testrun.fails++
|
87
|
-
testrun.report("NOT OK "+testrun.count+" - "+((message != null)? message : ""));
|
88
|
-
testrun.report("expected: "+expected);
|
89
|
-
testrun.report(" got: "+result);
|
90
|
-
}
|
91
|
-
}
|
92
|
-
catch(e) {
|
93
|
-
testrun.fails++
|
94
|
-
testrun.report("NOT OK "+testrun.count+" - "+((message != null)? message : ""));
|
95
|
-
testrun.report("expected: "+expected);
|
96
|
-
testrun.report(" got: "+result);}
|
97
|
-
}
|
98
|
-
|
99
|
-
/**
|
100
|
-
Check if test matches pattern.
|
101
|
-
@param {string} test To be evaluated.
|
102
|
-
@param {string} pattern Used to create a RegExp.
|
103
|
-
@param {string} message Optional. To be displayed in the report.
|
104
|
-
@return {boolean} True if test matches pattern.
|
105
|
-
*/
|
106
|
-
like = function(test, pattern, message) {
|
107
|
-
testrun.count++;
|
108
|
-
|
109
|
-
var result;
|
110
|
-
try {
|
111
|
-
result = eval(test);
|
112
|
-
var rgx = new RegExp(pattern);
|
113
|
-
|
114
|
-
if (rgx.test(result)) {
|
115
|
-
testrun.passes++
|
116
|
-
testrun.report(" OK "+testrun.count+" - "+((message != null)? message : ""));
|
117
|
-
}
|
118
|
-
else {
|
119
|
-
testrun.fails++
|
120
|
-
testrun.report("NOT OK "+testrun.count+" - "+((message != null)? message : ""));
|
121
|
-
testrun.report(" this: "+result);
|
122
|
-
testrun.report("is not like: "+pattern);
|
123
|
-
}
|
124
|
-
}
|
125
|
-
catch(e) {
|
126
|
-
testrun.fails++
|
127
|
-
testrun.report("NOT OK "+testrun.count+" - "+((message != null)? message : ""));
|
128
|
-
}
|
129
|
-
}
|
@@ -1,26 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
This is the main container for the FOODOC handler.
|
3
|
-
@namespace
|
4
|
-
*/
|
5
|
-
FOODOC = {
|
6
|
-
};
|
7
|
-
|
8
|
-
/** The current version string of this application. */
|
9
|
-
FOODOC.VERSION = "1.0";
|
10
|
-
|
11
|
-
FOODOC.handle = function(srcFile, src) {
|
12
|
-
LOG.inform("Handling file '" + srcFile + "'");
|
13
|
-
|
14
|
-
return [
|
15
|
-
new JSDOC.Symbol(
|
16
|
-
"foo",
|
17
|
-
[],
|
18
|
-
"VIRTUAL",
|
19
|
-
new JSDOC.DocComment("/** This is a foo. */")
|
20
|
-
)
|
21
|
-
];
|
22
|
-
};
|
23
|
-
|
24
|
-
FOODOC.publish = function(symbolgroup) {
|
25
|
-
LOG.inform("Publishing symbolgroup.");
|
26
|
-
};
|
@@ -1,26 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* This is the main container for the XMLDOC handler.
|
3
|
-
* @namespace
|
4
|
-
* @author Brett Fattori (bfattori@fry.com)
|
5
|
-
* @version $Revision: 498 $
|
6
|
-
*/
|
7
|
-
XMLDOC = {
|
8
|
-
|
9
|
-
};
|
10
|
-
|
11
|
-
/** The current version string of this application. */
|
12
|
-
XMLDOC.VERSION = "1.0";
|
13
|
-
|
14
|
-
/** Include the library necessary to handle XML files */
|
15
|
-
IO.includeDir("handlers/XMLDOC/");
|
16
|
-
|
17
|
-
/**
|
18
|
-
* @type Symbol[]
|
19
|
-
*/
|
20
|
-
XMLDOC.handle = function(srcFile, src) {
|
21
|
-
|
22
|
-
};
|
23
|
-
|
24
|
-
XMLDOC.publish = function(symbolgroup) {
|
25
|
-
|
26
|
-
}
|