MIRROR: javascript for 🐜's, a tiny runtime with big ambitions
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at master 23 lines 792 B view raw
1let failed = 0; 2 3function check(name, cond, detail) { 4 if (!cond) { 5 failed++; 6 console.log("FAIL", name, detail || ""); 7 } 8} 9 10const s = "false — must be >= 0"; 11const p = s.padEnd(25); 12check("padEnd length with em dash", p.length === 25, p.length); 13check("padEnd content with em dash", p === "false — must be >= 0 ", JSON.stringify(p)); 14 15const p2 = s.padStart(25); 16check("padStart length with em dash", p2.length === 25, p2.length); 17check("padStart content with em dash", p2 === " false — must be >= 0", JSON.stringify(p2)); 18 19const p3 = "ab".padEnd(5, "—"); 20check("padEnd unicode pad string", p3 === "ab———", JSON.stringify(p3)); 21check("padEnd unicode pad length", p3.length === 5, p3.length); 22 23if (failed > 0) throw new Error("test_string_pad_unicode failed");