Improve output: distinguish between failed assertions (failures) and unexpected exceptions (errors), and print a filtered stack trace for any exception.
This commit is contained in:
commit
4f2e303079
1839 changed files with 235630 additions and 0 deletions
105
webapp/web/src/string/Builder.js
Normal file
105
webapp/web/src/string/Builder.js
Normal file
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
Copyright (c) 2004-2006, The Dojo Foundation
|
||||
All Rights Reserved.
|
||||
|
||||
Licensed under the Academic Free License version 2.1 or above OR the
|
||||
modified BSD license. For more information on Dojo licensing, see:
|
||||
|
||||
http://dojotoolkit.org/community/licensing.shtml
|
||||
*/
|
||||
|
||||
dojo.provide("dojo.string.Builder");
|
||||
dojo.require("dojo.string");
|
||||
|
||||
// NOTE: testing shows that direct "+=" concatenation is *much* faster on
|
||||
// Spidermoneky and Rhino, while arr.push()/arr.join() style concatenation is
|
||||
// significantly quicker on IE (Jscript/wsh/etc.).
|
||||
|
||||
dojo.string.Builder = function(str){
|
||||
this.arrConcat = (dojo.render.html.capable && dojo.render.html["ie"]);
|
||||
|
||||
var a = [];
|
||||
var b = str || "";
|
||||
var length = this.length = b.length;
|
||||
|
||||
if(this.arrConcat){
|
||||
if(b.length > 0){
|
||||
a.push(b);
|
||||
}
|
||||
b = "";
|
||||
}
|
||||
|
||||
this.toString = this.valueOf = function(){
|
||||
return (this.arrConcat) ? a.join("") : b;
|
||||
};
|
||||
|
||||
this.append = function(s){
|
||||
if(this.arrConcat){
|
||||
a.push(s);
|
||||
}else{
|
||||
b+=s;
|
||||
}
|
||||
length += s.length;
|
||||
this.length = length;
|
||||
return this;
|
||||
};
|
||||
|
||||
this.clear = function(){
|
||||
a = [];
|
||||
b = "";
|
||||
length = this.length = 0;
|
||||
return this;
|
||||
};
|
||||
|
||||
this.remove = function(f,l){
|
||||
var s = "";
|
||||
if(this.arrConcat){
|
||||
b = a.join("");
|
||||
}
|
||||
a=[];
|
||||
if(f>0){
|
||||
s = b.substring(0, (f-1));
|
||||
}
|
||||
b = s + b.substring(f + l);
|
||||
length = this.length = b.length;
|
||||
if(this.arrConcat){
|
||||
a.push(b);
|
||||
b="";
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
this.replace = function(o,n){
|
||||
if(this.arrConcat){
|
||||
b = a.join("");
|
||||
}
|
||||
a = [];
|
||||
b = b.replace(o,n);
|
||||
length = this.length = b.length;
|
||||
if(this.arrConcat){
|
||||
a.push(b);
|
||||
b="";
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
this.insert = function(idx,s){
|
||||
if(this.arrConcat){
|
||||
b = a.join("");
|
||||
}
|
||||
a=[];
|
||||
if(idx == 0){
|
||||
b = s + b;
|
||||
}else{
|
||||
var t = b.split("");
|
||||
t.splice(idx,0,s);
|
||||
b = t.join("")
|
||||
}
|
||||
length = this.length = b.length;
|
||||
if(this.arrConcat){
|
||||
a.push(b);
|
||||
b="";
|
||||
}
|
||||
return this;
|
||||
};
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue