Subversion Repositories JSX

Compare Revisions

Last modification

Ignore whitespace Rev 420 → Rev 421

/trunk/test/unicode.js
17,9 → 17,11
},
{
feature: 'new jsx.string.unicode.WideString()',
description: 'Return new instance',
description: 'Return new empty instance',
code: function () {
assert(new WideString() instanceof WideString);
var s = new WideString();
assert(s instanceof WideString);
assertArrayEquals([], s.getChars());
}
},
{
31,6 → 33,13
}
},
{
feature: 'new jsx.string.unicode.WideString("")',
description: 'Return new empty instance',
code: function () {
assertArrayEquals([], new WideString("").getChars());
}
},
{
feature: 'new jsx.string.unicode.WideString("x")',
description: 'Convert to <code>WideString("x")</code>',
code: function () {
44,7 → 53,19
assertArrayEquals(["4", "2"], new WideString(42).getChars());
}
},
 
{
feature: 'new jsx.string.unicode.WideString(string).getChars()',
description: 'Return the correct value',
code: function () {
assertArrayEquals([], new WideString().getChars());
assertArrayEquals([], new WideString("").getChars());
assertArrayEquals(["x"], new WideString("x").getChars());
assertArrayEquals(["x", "\uD834\uDD1E"], new WideString("x\uD834\uDD1E").getChars());
assertArrayEquals(["x", "\uD834\uDD1E", "y"], new WideString("x\uD834\uDD1Ey").getChars());
}
},
{
feature: 'new jsx.string.unicode.WideString(string).chars',
description: 'Getter works',
code: function () {
53,6 → 74,25
},
 
{
feature: 'new jsx.string.unicode.WideString(string).getLength()',
description: 'Return the correct value',
code: function () {
assert(new WideString().getLength() === 0);
assert(new WideString("").getLength() === 0);
assert(new WideString("x").getLength() === 1);
assert(new WideString("x\uD834\uDD1E").getLength() === 2);
assert(new WideString("x\uD834\uDD1Ey").getLength() === 3);
}
},
{
feature: 'new jsx.string.unicode.WideString(string).length',
description: 'Inherited getter works',
code: function () {
assert(new WideString("x").length === 1);
}
},
 
{
feature: 'jsx.string.unicode.WideString.fromCharCode(0x110000)',
description: 'throw <code>jsx.InvalidArgumentError</code>',
code: function () {
75,7 → 115,7
},
{
feature: 'jsx.string.unicode.WideString.fromCharCode(0x1D11E)',
description: 'return <code>"\\uD834\\uDD1E"</code>',
description: 'Return <code>"\\uD834\\uDD1E"</code>',
code: function () {
var chars = WideString.fromCharCode(0x1D11E).getChars();
assertArrayEquals(["\uD834\uDD1E"], chars);
/trunk/string/unicode.js
296,6 → 296,16
}()),
 
/**
* Returns the number of characters in this string
*
* @return {int}
* @see #length
*/
getLength: function () {
return this.getChars().length;
},
 
/**
* Returns the index of the first position of a substring
* in this string.
*
441,6 → 451,18
});
 
/**
* @name length
* @type int
* @memberOf jsx.string.unicode.WideString#prototype
* @see #getLength()
*/
jsx.object.defineProperty(_WideString.prototype, "length", {
"get": function () {
return this.getLength();
}
});
 
/**
* Returns the <code>string</code> value consisting of the
* characters specified by their code point values.
*