Lines Matching full:endswith
28 assertEquals(1, String.prototype.endsWith.length);
31 assertTrue(testString.endsWith(""));
32 assertTrue(testString.endsWith("World"));
33 assertFalse(testString.endsWith("world"));
34 assertFalse(testString.endsWith("Hello World!"));
35 assertFalse(testString.endsWith(null));
36 assertFalse(testString.endsWith(undefined));
38 assertTrue("null".endsWith(null));
39 assertTrue("undefined".endsWith(undefined));
42 assertTrue(georgianUnicodeString.endsWith(georgianUnicodeString));
43 assertTrue(georgianUnicodeString.endsWith("\u10D4\u10D5\u10D6\u10D7"));
44 assertFalse(georgianUnicodeString.endsWith("\u10D0"));
46 assertThrows("String.prototype.endsWith.call(null, 'test')", TypeError);
47 assertThrows("String.prototype.endsWith.call(null, null)", TypeError);
48 assertThrows("String.prototype.endsWith.call(undefined, undefined)", TypeError);
50 assertThrows("String.prototype.endsWith.apply(null, ['test'])", TypeError);
51 assertThrows("String.prototype.endsWith.apply(null, [null])", TypeError);
52 assertThrows("String.prototype.endsWith.apply(undefined, [undefined])", TypeError);
82 assertTrue(s.endsWith(v), e.msg);
83 assertTrue(String.prototype.endsWith.call(v, v), e.msg);
84 assertTrue(String.prototype.endsWith.apply(v, [v]), e.msg);
90 this.endsWith = String.prototype.endsWith;
104 assertTrue(o.endsWith(v), e.msg);
111 assertTrue("abc".endsWith("abc"));
112 assertTrue("abcd".endsWith("bcd"));
113 assertTrue("abc".endsWith("c"));
114 assertFalse("abc".endsWith("abcd"));
115 assertFalse("abc".endsWith("bbc"));
116 assertFalse("abc".endsWith("b"));
117 assertTrue("abc".endsWith("abc", 3));
118 assertTrue("abc".endsWith("bc", 3));
119 assertFalse("abc".endsWith("a", 3));
120 assertTrue("abc".endsWith("bc", 3));
121 assertTrue("abc".endsWith("a", 1));
122 assertFalse("abc".endsWith("abc", 1));
123 assertTrue("abc".endsWith("b", 2));
124 assertFalse("abc".endsWith("d", 2));
125 assertFalse("abc".endsWith("dcd", 2));
126 assertFalse("abc".endsWith("a", 42));
127 assertTrue("abc".endsWith("bc", Infinity));
128 assertFalse("abc".endsWith("a", Infinity));
129 assertTrue("abc".endsWith("bc", undefined));
130 assertFalse("abc".endsWith("bc", -43));
131 assertFalse("abc".endsWith("bc", -Infinity));
132 assertFalse("abc".endsWith("bc", NaN));
135 // https://github.com/mathiasbynens/String.prototype.endsWith/blob/master/tests/tests.js
138 assertEquals(String.prototype.endsWith.length, 1);
139 assertEquals(String.prototype.propertyIsEnumerable("endsWith"), false);
141 assertEquals("undefined".endsWith(), true);
142 assertEquals("undefined".endsWith(undefined), true);
143 assertEquals("undefined".endsWith(null), false);
144 assertEquals("null".endsWith(), false);
145 assertEquals("null".endsWith(undefined), false);
146 assertEquals("null".endsWith(null), true);
148 assertEquals("abc".endsWith(), false);
149 assertEquals("abc".endsWith(""), true);
150 assertEquals("abc".endsWith("\0"), false);
151 assertEquals("abc".endsWith("c"), true);
152 assertEquals("abc".endsWith("b"), false);
153 assertEquals("abc".endsWith("ab"), false);
154 assertEquals("abc".endsWith("bc"), true);
155 assertEquals("abc".endsWith("abc"), true);
156 assertEquals("abc".endsWith("bcd"), false);
157 assertEquals("abc".endsWith("abcd"), false);
158 assertEquals("abc".endsWith("bcde"), false);
160 assertEquals("abc".endsWith("", NaN), true);
161 assertEquals("abc".endsWith("\0", NaN), false);
162 assertEquals("abc".endsWith("c", NaN), false);
163 assertEquals("abc".endsWith("b", NaN), false);
164 assertEquals("abc".endsWith("ab", NaN), false);
165 assertEquals("abc".endsWith("bc", NaN), false);
166 assertEquals("abc".endsWith("abc", NaN), false);
167 assertEquals("abc".endsWith("bcd", NaN), false);
168 assertEquals("abc".endsWith("abcd", NaN), false);
169 assertEquals("abc".endsWith("bcde", NaN), false);
171 assertEquals("abc".endsWith("", false), true);
172 assertEquals("abc".endsWith("\0", false), false);
173 assertEquals("abc".endsWith("c", false), false);
174 assertEquals("abc".endsWith("b", false), false);
175 assertEquals("abc".endsWith("ab", false), false);
176 assertEquals("abc".endsWith("bc", false), false);
177 assertEquals("abc".endsWith("abc", false), false);
178 assertEquals("abc".endsWith("bcd", false), false);
179 assertEquals("abc".endsWith("abcd", false), false);
180 assertEquals("abc".endsWith("bcde", false), false);
182 assertEquals("abc".endsWith("", undefined), true);
183 assertEquals("abc".endsWith("\0", undefined), false);
184 assertEquals("abc".endsWith("c", undefined), true);
185 assertEquals("abc".endsWith("b", undefined), false);
186 assertEquals("abc".endsWith("ab", undefined), false);
187 assertEquals("abc".endsWith("bc", undefined), true);
188 assertEquals("abc".endsWith("abc", undefined), true);
189 assertEquals("abc".endsWith("bcd", undefined), false);
190 assertEquals("abc".endsWith("abcd", undefined), false);
191 assertEquals("abc".endsWith("bcde", undefined), false);
193 assertEquals("abc".endsWith("", null), true);
194 assertEquals("abc".endsWith("\0", null), false);
195 assertEquals("abc".endsWith("c", null), false);
196 assertEquals("abc".endsWith("b", null), false);
197 assertEquals("abc".endsWith("ab", null), false);
198 assertEquals("abc".endsWith("bc", null), false);
199 assertEquals("abc".endsWith("abc", null), false);
200 assertEquals("abc".endsWith("bcd", null), false);
201 assertEquals("abc".endsWith("abcd", null), false);
202 assertEquals("abc".endsWith("bcde", null), false);
204 assertEquals("abc".endsWith("", -Infinity), true);
205 assertEquals("abc".endsWith("\0", -Infinity), false);
206 assertEquals("abc".endsWith("c", -Infinity), false);
207 assertEquals("abc".endsWith("b", -Infinity), false);
208 assertEquals("abc".endsWith("ab", -Infinity), false);
209 assertEquals("abc".endsWith("bc", -Infinity), false);
210 assertEquals("abc".endsWith("abc", -Infinity), false);
211 assertEquals("abc".endsWith("bcd", -Infinity), false);
212 assertEquals("abc".endsWith("abcd", -Infinity), false);
213 assertEquals("abc".endsWith("bcde", -Infinity), false);
215 assertEquals("abc".endsWith("", -1), true);
216 assertEquals("abc".endsWith("\0", -1), false);
217 assertEquals("abc".endsWith("c", -1), false);
218 assertEquals("abc".endsWith("b", -1), false);
219 assertEquals("abc".endsWith("ab", -1), false);
220 assertEquals("abc".endsWith("bc", -1), false);
221 assertEquals("abc".endsWith("abc", -1), false);
222 assertEquals("abc".endsWith("bcd", -1), false);
223 assertEquals("abc".endsWith("abcd", -1), false);
224 assertEquals("abc".endsWith("bcde", -1), false);
226 assertEquals("abc".endsWith("", -0), true);
227 assertEquals("abc".endsWith("\0", -0), false);
228 assertEquals("abc".endsWith("c", -0), false);
229 assertEquals("abc".endsWith("b", -0), false);
230 assertEquals("abc".endsWith("ab", -0), false);
231 assertEquals("abc".endsWith("bc", -0), false);
232 assertEquals("abc".endsWith("abc", -0), false);
233 assertEquals("abc".endsWith("bcd", -0), false);
234 assertEquals("abc".endsWith("abcd", -0), false);
235 assertEquals("abc".endsWith("bcde", -0), false);
237 assertEquals("abc".endsWith("", +0), true);
238 assertEquals("abc".endsWith("\0", +0), false);
239 assertEquals("abc".endsWith("c", +0), false);
240 assertEquals("abc".endsWith("b", +0), false);
241 assertEquals("abc".endsWith("ab", +0), false);
242 assertEquals("abc".endsWith("bc", +0), false);
243 assertEquals("abc".endsWith("abc", +0), false);
244 assertEquals("abc".endsWith("bcd", +0), false);
245 assertEquals("abc".endsWith("abcd", +0), false);
246 assertEquals("abc".endsWith("bcde", +0), false);
248 assertEquals("abc".endsWith("", 1), true);
249 assertEquals("abc".endsWith("\0", 1), false);
250 assertEquals("abc".endsWith("c", 1), false);
251 assertEquals("abc".endsWith("b", 1), false);
252 assertEquals("abc".endsWith("ab", 1), false);
253 assertEquals("abc".endsWith("bc", 1), false);
254 assertEquals("abc".endsWith("abc", 1), false);
255 assertEquals("abc".endsWith("bcd", 1), false);
256 assertEquals("abc".endsWith("abcd", 1), false);
257 assertEquals("abc".endsWith("bcde", 1), false);
259 assertEquals("abc".endsWith("", 2), true);
260 assertEquals("abc".endsWith("\0", 2), false);
261 assertEquals("abc".endsWith("c", 2), false);
262 assertEquals("abc".endsWith("b", 2), true);
263 assertEquals("abc".endsWith("ab", 2), true);
264 assertEquals("abc".endsWith("bc", 2), false);
265 assertEquals("abc".endsWith("abc", 2), false);
266 assertEquals("abc".endsWith("bcd", 2), false);
267 assertEquals("abc".endsWith("abcd", 2), false);
268 assertEquals("abc".endsWith("bcde", 2), false);
270 assertEquals("abc".endsWith("", +Infinity), true);
271 assertEquals("abc".endsWith("\0", +Infinity), false);
272 assertEquals("abc".endsWith("c", +Infinity), true);
273 assertEquals("abc".endsWith("b", +Infinity), false);
274 assertEquals("abc".endsWith("ab", +Infinity), false);
275 assertEquals("abc".endsWith("bc", +Infinity), true);
276 assertEquals("abc".endsWith("abc", +Infinity), true);
277 assertEquals("abc".endsWith("bcd", +Infinity), false);
278 assertEquals("abc".endsWith("abcd", +Infinity), false);
279 assertEquals("abc".endsWith("bcde", +Infinity), false);
281 assertEquals("abc".endsWith("", true), true);
282 assertEquals("abc".endsWith("\0", true), false);
283 assertEquals("abc".endsWith("c", true), false);
284 assertEquals("abc".endsWith("b", true), false);
285 assertEquals("abc".endsWith("ab", true), false);
286 assertEquals("abc".endsWith("bc", true), false);
287 assertEquals("abc".endsWith("abc", true), false);
288 assertEquals("abc".endsWith("bcd", true), false);
289 assertEquals("abc".endsWith("abcd", true), false);
290 assertEquals("abc".endsWith("bcde", true), false);
292 assertEquals("abc".endsWith("", "x"), true);
293 assertEquals("abc".endsWith("\0", "x"), false);
294 assertEquals("abc".endsWith("c", "x"), false);
295 assertEquals("abc".endsWith("b", "x"), false);
296 assertEquals("abc".endsWith("ab", "x"), false);
297 assertEquals("abc".endsWith("bc", "x"), false);
298 assertEquals("abc".endsWith("abc", "x"), false);
299 assertEquals("abc".endsWith("bcd", "x"), false);
300 assertEquals("abc".endsWith("abcd", "x"), false);
301 assertEquals("abc".endsWith("bcde", "x"), false);
303 assertEquals("[a-z]+(bar)?".endsWith("(bar)?"), true);
304 assertThrows(function() { "[a-z]+(bar)?".endsWith(/(bar)?/);
306 assertEquals("[a-z]+(bar)?".endsWith("[a-z]+", 6), true);
307 assertThrows(function() { "[a-z]+(bar)?".endsWith(/(bar)?/);
309 assertThrows(function() { "[a-z]+/(bar)?/".endsWith(/(bar)?/);
314 assertEquals(string.endsWith(""), true);
315 assertEquals(string.endsWith("\xF1t\xEBr"), false);
316 assertEquals(string.endsWith("\xF1t\xEBr", 5), true);
317 assertEquals(string.endsWith("\xE0liz\xE6"), false);
318 assertEquals(string.endsWith("\xE0liz\xE6", 16), true);
319 assertEquals(string.endsWith("\xF8n\u2603\uD83D\uDCA9"), true);
320 assertEquals(string.endsWith("\xF8n\u2603\uD83D\uDCA9", 23), true);
321 assertEquals(string.endsWith("\u2603"), false);
322 assertEquals(string.endsWith("\u2603", 21), true);
323 assertEquals(string.endsWith("\uD83D\uDCA9"), true);
324 assertEquals(string.endsWith("\uD83D\uDCA9", 23), true);
327 String.prototype.endsWith.call(undefined);
330 String.prototype.endsWith.call(undefined, "b");
333 String.prototype.endsWith.call(undefined, "b", 4);
336 String.prototype.endsWith.call(null);
339 String.prototype.endsWith.call(null, "b");
342 String.prototype.endsWith.call(null, "b", 4);
344 assertEquals(String.prototype.endsWith.call(42, "2"), true);
345 assertEquals(String.prototype.endsWith.call(42, "4"), false);
346 assertEquals(String.prototype.endsWith.call(42, "b", 4), false);
347 assertEquals(String.prototype.endsWith.call(42, "2", 1), false);
348 assertEquals(String.prototype.endsWith.call(42, "2", 4), true);
349 assertEquals(String.prototype.endsWith.call({
352 assertEquals(String.prototype.endsWith.call({
355 assertEquals(String.prototype.endsWith.call({
359 String.prototype.endsWith.call({
364 String.prototype.endsWith.call({
370 String.prototype.endsWith.apply(undefined);
373 String.prototype.endsWith.apply(undefined, ["b"]); },
376 String.prototype.endsWith.apply(undefined, ["b", 4]);
379 String.prototype.endsWith.apply(null);
382 String.prototype.endsWith.apply(null, ["b"]);
385 String.prototype.endsWith.apply(null, ["b", 4]);
387 assertEquals(String.prototype.endsWith.apply(42, ["2"]), true);
388 assertEquals(String.prototype.endsWith.apply(42, ["4"]), false);
389 assertEquals(String.prototype.endsWith.apply(42, ["b", 4]), false);
390 assertEquals(String.prototype.endsWith.apply(42, ["2", 1]), false);
391 assertEquals(String.prototype.endsWith.apply(42, ["2", 4]), true);
392 assertEquals(String.prototype.endsWith.apply({
395 assertEquals(String.prototype.endsWith.apply({
398 assertEquals(String.prototype.endsWith.apply({
402 String.prototype.endsWith.apply({
407 String.prototype.endsWith.apply({
412 // endsWith does its brand checks with Symbol.match