// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

js> load('testsrc/doctests/util.js');

js> String.prototype.trim;
function trim() { [native code for String.trim, arity=0] }

js> String.prototype.trim.call({toString: function() { return "a" }});
a

js> "  hello ".trim() === "hello";
true

js> var chr = String.fromCharCode;
js> var str = "" +
  >   // ecma whitespace
  >   chr(0x0009) + chr(0x000B) + chr(0x000C) + chr(0x0020) + chr(0x00A0) + chr(0xFEFF) + 
  >   // unicode whitespace
  >   chr(0x1680) + chr(0x180E) + 
  >   chr(0x2000) + chr(0x2001) + chr(0x2002) + chr(0x2003) + chr(0x2004) + chr(0x2005) + chr(0x2006) + chr(0x2007) + chr(0x2008) + chr(0x2009) + chr(0x200A) + 
  >   chr(0x202F) + chr(0x205F) + chr(0x3000) + 
  >   // ecma line terminators
  >   chr(0x000A) + chr(0x000D) + chr(0x2028) + chr(0x2029) +
  >
  >   "abc";
js> str.trim() === "abc";
true
