OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Flags: --harmony-string-padding | |
6 | |
7 (function TestMeta() { | 5 (function TestMeta() { |
8 assertEquals(1, String.prototype.padEnd.length); | 6 assertEquals(1, String.prototype.padEnd.length); |
9 assertEquals("function", typeof String.prototype.padEnd); | 7 assertEquals("function", typeof String.prototype.padEnd); |
10 assertEquals(Object.getPrototypeOf(Function), | 8 assertEquals(Object.getPrototypeOf(Function), |
11 Object.getPrototypeOf(String.prototype.padEnd)); | 9 Object.getPrototypeOf(String.prototype.padEnd)); |
12 assertEquals("padEnd", String.prototype.padEnd.name); | 10 assertEquals("padEnd", String.prototype.padEnd.name); |
13 | 11 |
14 var desc = Object.getOwnPropertyDescriptor(String.prototype, "padEnd"); | 12 var desc = Object.getOwnPropertyDescriptor(String.prototype, "padEnd"); |
15 assertFalse(desc.enumerable); | 13 assertFalse(desc.enumerable); |
16 assertTrue(desc.configurable); | 14 assertTrue(desc.configurable); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 var actual = "123".padEnd(i, "xoxo"); | 87 var actual = "123".padEnd(i, "xoxo"); |
90 assertEquals(expected, actual); | 88 assertEquals(expected, actual); |
91 assertEquals(i > "123".length ? i : 3, actual.length); | 89 assertEquals(i > "123".length ? i : 3, actual.length); |
92 } | 90 } |
93 })(); | 91 })(); |
94 | 92 |
95 | 93 |
96 (function TestTruncation() { | 94 (function TestTruncation() { |
97 assertEquals("ab", "a".padEnd(2, "bc")); | 95 assertEquals("ab", "a".padEnd(2, "bc")); |
98 })(); | 96 })(); |
OLD | NEW |