OLD | NEW |
1 // Copyright (c) 2009 Apple Computer, Inc. All rights reserved. | 1 // Copyright (c) 2009 Apple Computer, Inc. All rights reserved. |
2 // | 2 // |
3 // Redistribution and use in source and binary forms, with or without | 3 // Redistribution and use in source and binary forms, with or without |
4 // modification, are permitted provided that the following conditions | 4 // modification, are permitted provided that the following conditions |
5 // are met: | 5 // are met: |
6 // | 6 // |
7 // 1. Redistributions of source code must retain the above copyright | 7 // 1. Redistributions of source code must retain the above copyright |
8 // notice, this list of conditions and the following disclaimer. | 8 // notice, this list of conditions and the following disclaimer. |
9 // | 9 // |
10 // 2. Redistributions in binary form must reproduce the above | 10 // 2. Redistributions in binary form must reproduce the above |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 assertEquals(trimString.trimRight(), rightTrimString); | 89 assertEquals(trimString.trimRight(), rightTrimString); |
90 | 90 |
91 assertEquals(leftTrimString.trim(), testString); | 91 assertEquals(leftTrimString.trim(), testString); |
92 assertEquals(leftTrimString.trimLeft(), leftTrimString); | 92 assertEquals(leftTrimString.trimLeft(), leftTrimString); |
93 assertEquals(leftTrimString.trimRight(), testString); | 93 assertEquals(leftTrimString.trimRight(), testString); |
94 | 94 |
95 assertEquals(rightTrimString.trim(), testString); | 95 assertEquals(rightTrimString.trim(), testString); |
96 assertEquals(rightTrimString.trimLeft(), testString); | 96 assertEquals(rightTrimString.trimLeft(), testString); |
97 assertEquals(rightTrimString.trimRight(), rightTrimString); | 97 assertEquals(rightTrimString.trimRight(), rightTrimString); |
98 | 98 |
99 var testValues = [0, Infinity, NaN, true, false, ({}), ['an','array'] | 99 var testValues = [0, Infinity, NaN, true, false, ({}), ['an','array'], |
100 ({toString:function(){return 'wibble'}}) | 100 ({toString:function(){return 'wibble'}}) |
101 ]; | 101 ]; |
102 | 102 |
103 for (var i = 0; i < testValues.length; i++) { | 103 for (var i = 0; i < testValues.length; i++) { |
104 assertEquals(trim.call(testValues[i]), String(testValues[i])); | 104 assertEquals(trim.call(testValues[i]), String(testValues[i])); |
105 assertEquals(trimLeft.call(testValues[i]), String(testValues[i])); | 105 assertEquals(trimLeft.call(testValues[i]), String(testValues[i])); |
106 assertEquals(trimRight.call(testValues[i]), String(testValues[i])); | 106 assertEquals(trimRight.call(testValues[i]), String(testValues[i])); |
107 } | 107 } |
OLD | NEW |