3 Copyright 2012 Yahoo! Inc. All rights reserved.
4 Licensed under the BSD License.
5 http://yuilibrary.com/license/
7 if (typeof _yuitest_coverage == "undefined"){
8 _yuitest_coverage = {};
9 _yuitest_coverline = function(src, line){
10 var coverage = _yuitest_coverage[src];
11 if (!coverage.lines[line]){
12 coverage.calledLines++;
14 coverage.lines[line]++;
16 _yuitest_coverfunc = function(src, name, line){
17 var coverage = _yuitest_coverage[src],
18 funcId = name + ":" + line;
19 if (!coverage.functions[funcId]){
20 coverage.calledFunctions++;
22 coverage.functions[funcId]++;
25 _yuitest_coverage["build/dump/dump.js"] = {
32 path: "build/dump/dump.js",
35 _yuitest_coverage["build/dump/dump.js"].code=["YUI.add('dump', function (Y, NAME) {","","/**"," * Returns a simple string representation of the object or array."," * Other types of objects will be returned unprocessed. Arrays"," * are expected to be indexed. Use object notation for"," * associative arrays."," *"," * If included, the dump method is added to the YUI instance."," *"," * @module dump"," */",""," var L = Y.Lang,"," OBJ = '{...}',"," FUN = 'f(){...}',"," COMMA = ', ',"," ARROW = ' => ',",""," /**"," * Returns a simple string representation of the object or array."," * Other types of objects will be returned unprocessed. Arrays"," * are expected to be indexed."," *"," * @method dump"," * @param {Object} o The object to dump."," * @param {Number} d How deep to recurse child objects, default 3."," * @return {String} the dump result."," * @for YUI"," */"," dump = function(o, d) {"," var i, len, s = [], type = L.type(o);",""," // Cast non-objects to string"," // Skip dates because the std toString is what we want"," // Skip HTMLElement-like objects because trying to dump"," // an element will cause an unhandled exception in FF 2.x"," if (!L.isObject(o)) {"," return o + '';"," } else if (type == 'date') {"," return o;"," } else if (o.nodeType && o.tagName) {"," return o.tagName + '#' + o.id;"," } else if (o.document && o.navigator) {"," return 'window';"," } else if (o.location && o.body) {"," return 'document';"," } else if (type == 'function') {"," return FUN;"," }",""," // dig into child objects the depth specifed. Default 3"," d = (L.isNumber(d)) ? d : 3;",""," // arrays [1, 2, 3]"," if (type == 'array') {"," s.push('[');"," for (i = 0, len = o.length; i < len; i = i + 1) {"," if (L.isObject(o[i])) {"," s.push((d > 0) ? L.dump(o[i], d - 1) : OBJ);"," } else {"," s.push(o[i]);"," }"," s.push(COMMA);"," }"," if (s.length > 1) {"," s.pop();"," }"," s.push(']');"," // regexp /foo/"," } else if (type == 'regexp') {"," s.push(o.toString());"," // objects {k1 => v1, k2 => v2}"," } else {"," s.push('{');"," for (i in o) {"," if (o.hasOwnProperty(i)) {"," try {"," s.push(i + ARROW);"," if (L.isObject(o[i])) {"," s.push((d > 0) ? L.dump(o[i], d - 1) : OBJ);"," } else {"," s.push(o[i]);"," }"," s.push(COMMA);"," } catch (e) {"," s.push('Error: ' + e.message);"," }"," }"," }"," if (s.length > 1) {"," s.pop();"," }"," s.push('}');"," }",""," return s.join('');"," };",""," Y.dump = dump;"," L.dump = dump;","","","","}, '3.7.1', {\"requires\": [\"yui-base\"]});"];
36 _yuitest_coverage["build/dump/dump.js"].lines = {"1":0,"14":0,"32":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"53":0,"56":0,"57":0,"58":0,"59":0,"60":0,"62":0,"64":0,"66":0,"67":0,"69":0,"71":0,"72":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"83":0,"85":0,"87":0,"91":0,"92":0,"94":0,"97":0,"100":0,"101":0};
37 _yuitest_coverage["build/dump/dump.js"].functions = {"dump:31":0,"(anonymous 1):1":0};
38 _yuitest_coverage["build/dump/dump.js"].coveredLines = 44;
39 _yuitest_coverage["build/dump/dump.js"].coveredFunctions = 2;
40 _yuitest_coverline("build/dump/dump.js", 1);
41 YUI.add('dump', function (Y, NAME) {
44 * Returns a simple string representation of the object or array.
45 * Other types of objects will be returned unprocessed. Arrays
46 * are expected to be indexed. Use object notation for
49 * If included, the dump method is added to the YUI instance.
54 _yuitest_coverfunc("build/dump/dump.js", "(anonymous 1)", 1);
55 _yuitest_coverline("build/dump/dump.js", 14);
63 * Returns a simple string representation of the object or array.
64 * Other types of objects will be returned unprocessed. Arrays
65 * are expected to be indexed.
68 * @param {Object} o The object to dump.
69 * @param {Number} d How deep to recurse child objects, default 3.
70 * @return {String} the dump result.
73 dump = function(o, d) {
74 _yuitest_coverfunc("build/dump/dump.js", "dump", 31);
75 _yuitest_coverline("build/dump/dump.js", 32);
76 var i, len, s = [], type = L.type(o);
78 // Cast non-objects to string
79 // Skip dates because the std toString is what we want
80 // Skip HTMLElement-like objects because trying to dump
81 // an element will cause an unhandled exception in FF 2.x
82 _yuitest_coverline("build/dump/dump.js", 38);
84 _yuitest_coverline("build/dump/dump.js", 39);
86 } else {_yuitest_coverline("build/dump/dump.js", 40);
88 _yuitest_coverline("build/dump/dump.js", 41);
90 } else {_yuitest_coverline("build/dump/dump.js", 42);
91 if (o.nodeType && o.tagName) {
92 _yuitest_coverline("build/dump/dump.js", 43);
93 return o.tagName + '#' + o.id;
94 } else {_yuitest_coverline("build/dump/dump.js", 44);
95 if (o.document && o.navigator) {
96 _yuitest_coverline("build/dump/dump.js", 45);
98 } else {_yuitest_coverline("build/dump/dump.js", 46);
99 if (o.location && o.body) {
100 _yuitest_coverline("build/dump/dump.js", 47);
102 } else {_yuitest_coverline("build/dump/dump.js", 48);
103 if (type == 'function') {
104 _yuitest_coverline("build/dump/dump.js", 49);
108 // dig into child objects the depth specifed. Default 3
109 _yuitest_coverline("build/dump/dump.js", 53);
110 d = (L.isNumber(d)) ? d : 3;
113 _yuitest_coverline("build/dump/dump.js", 56);
114 if (type == 'array') {
115 _yuitest_coverline("build/dump/dump.js", 57);
117 _yuitest_coverline("build/dump/dump.js", 58);
118 for (i = 0, len = o.length; i < len; i = i + 1) {
119 _yuitest_coverline("build/dump/dump.js", 59);
120 if (L.isObject(o[i])) {
121 _yuitest_coverline("build/dump/dump.js", 60);
122 s.push((d > 0) ? L.dump(o[i], d - 1) : OBJ);
124 _yuitest_coverline("build/dump/dump.js", 62);
127 _yuitest_coverline("build/dump/dump.js", 64);
130 _yuitest_coverline("build/dump/dump.js", 66);
132 _yuitest_coverline("build/dump/dump.js", 67);
135 _yuitest_coverline("build/dump/dump.js", 69);
138 } else {_yuitest_coverline("build/dump/dump.js", 71);
139 if (type == 'regexp') {
140 _yuitest_coverline("build/dump/dump.js", 72);
141 s.push(o.toString());
142 // objects {k1 => v1, k2 => v2}
144 _yuitest_coverline("build/dump/dump.js", 75);
146 _yuitest_coverline("build/dump/dump.js", 76);
148 _yuitest_coverline("build/dump/dump.js", 77);
149 if (o.hasOwnProperty(i)) {
150 _yuitest_coverline("build/dump/dump.js", 78);
152 _yuitest_coverline("build/dump/dump.js", 79);
154 _yuitest_coverline("build/dump/dump.js", 80);
155 if (L.isObject(o[i])) {
156 _yuitest_coverline("build/dump/dump.js", 81);
157 s.push((d > 0) ? L.dump(o[i], d - 1) : OBJ);
159 _yuitest_coverline("build/dump/dump.js", 83);
162 _yuitest_coverline("build/dump/dump.js", 85);
165 _yuitest_coverline("build/dump/dump.js", 87);
166 s.push('Error: ' + e.message);
170 _yuitest_coverline("build/dump/dump.js", 91);
172 _yuitest_coverline("build/dump/dump.js", 92);
175 _yuitest_coverline("build/dump/dump.js", 94);
179 _yuitest_coverline("build/dump/dump.js", 97);
183 _yuitest_coverline("build/dump/dump.js", 100);
185 _yuitest_coverline("build/dump/dump.js", 101);
190 }, '3.7.1', {"requires": ["yui-base"]});