1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/js1_4/Regress/function-003.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,60 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 + 1.10 +/** 1.11 + * File Name: function-003.js 1.12 + * Description: 1.13 + * 1.14 + * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=104766 1.15 + * 1.16 + * Author: christine@netscape.com 1.17 + * Date: 11 August 1998 1.18 + */ 1.19 +var SECTION = "toString-001.js"; 1.20 +var VERSION = "JS1_4"; 1.21 +var TITLE = "Regression test case for 104766"; 1.22 +var BUGNUMBER="310514"; 1.23 + 1.24 +startTest(); 1.25 + 1.26 +writeHeaderToLog( SECTION + " "+ TITLE); 1.27 + 1.28 +new TestCase( 1.29 + SECTION, 1.30 + "StripSpaces(Array.prototype.concat.toString()).substring(0,17)", 1.31 + "functionconcat(){", 1.32 + StripSpaces(Array.prototype.concat.toString()).substring(0,17)); 1.33 + 1.34 +test(); 1.35 + 1.36 +function StripSpaces( s ) { 1.37 + for ( var currentChar = 0, strippedString=""; 1.38 + currentChar < s.length; currentChar++ ) 1.39 + { 1.40 + if (!IsWhiteSpace(s.charAt(currentChar))) { 1.41 + strippedString += s.charAt(currentChar); 1.42 + } 1.43 + } 1.44 + return strippedString; 1.45 +} 1.46 + 1.47 +function IsWhiteSpace( string ) { 1.48 + var cc = string.charCodeAt(0); 1.49 + switch (cc) { 1.50 + case (0x0009): 1.51 + case (0x000B): 1.52 + case (0x000C): 1.53 + case (0x0020): 1.54 + case (0x000A): 1.55 + case (0x000D): 1.56 + case ( 59 ): // let's strip out semicolons, too 1.57 + return true; 1.58 + break; 1.59 + default: 1.60 + return false; 1.61 + } 1.62 +} 1.63 +