Skip to content
Snippets Groups Projects
Commit fea42451 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

A very basic initial set of tests for format()

parent f23c0db4
No related branches found
No related tags found
No related merge requests found
Pipeline #7814 passed
const args = [ 1, 1.1, true, "one", -1, 1e9 ];
const test = {
"%s": "1",
"%d": "1",
"%i": "1",
"%u": "1",
"%02d": "01",
"%02x": "01",
"%02u": "01",
"%02i": "01",
"%d %.2f": "1 1.10",
"%d %d %d": "1 1 1",
"%4$s": "one",
"%4$.2s": "on",
"%4$5s": " one",
"%4$-5s": "one ",
"%5$d": "-1",
"%5$x": "ffffffff",
"%6$u": "1000000000",
};
for (var i in test) {
var result = format.apply(null, [i].concat(args));
if (result != test[i])
throw new Error("format(" + i + ") = '" + result + "' instead of '" + test[i] + "'");
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment