Annotate

spec/util_format_spec.lua @ 12036:2ce06f788093

util.format: Fix some formats expecting positive numbers in Lua 5.2 Amazing how string.format behaves differently under each Lua version
author Kim Alvefur <zash@zash.se>
date Sat, 11 Dec 2021 20:54:37 +0100
parent 12034:ee94ac51b2dd
child 12039:e0a8c5b1ab4f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8383
d967d6f2ad00 util.format: Move tests to spec/
Kim Alvefur <zash@zash.se>
parents:
diff changeset
1 local format = require "util.format".format;
12034
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
2 -- There are eight basic types in Lua:
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
3 -- nil, boolean, number, string, function, userdata, thread, and table
8383
d967d6f2ad00 util.format: Move tests to spec/
Kim Alvefur <zash@zash.se>
parents:
diff changeset
4
d967d6f2ad00 util.format: Move tests to spec/
Kim Alvefur <zash@zash.se>
parents:
diff changeset
5 describe("util.format", function()
d967d6f2ad00 util.format: Move tests to spec/
Kim Alvefur <zash@zash.se>
parents:
diff changeset
6 describe("#format()", function()
d967d6f2ad00 util.format: Move tests to spec/
Kim Alvefur <zash@zash.se>
parents:
diff changeset
7 it("should work", function()
8619
b96b0141cb61 util.format: Fix tests to have expected value first
Kim Alvefur <zash@zash.se>
parents: 8383
diff changeset
8 assert.equal("hello", format("%s", "hello"));
11644
fc1b8fe94d04 util.format: Change formatting of nil values to avoid looking like XML
Kim Alvefur <zash@zash.se>
parents: 11638
diff changeset
9 assert.equal("(nil)", format("%s"));
fc1b8fe94d04 util.format: Change formatting of nil values to avoid looking like XML
Kim Alvefur <zash@zash.se>
parents: 11638
diff changeset
10 assert.equal("(nil)", format("%d"));
fc1b8fe94d04 util.format: Change formatting of nil values to avoid looking like XML
Kim Alvefur <zash@zash.se>
parents: 11638
diff changeset
11 assert.equal("(nil)", format("%q"));
fc1b8fe94d04 util.format: Change formatting of nil values to avoid looking like XML
Kim Alvefur <zash@zash.se>
parents: 11638
diff changeset
12 assert.equal(" [(nil)]", format("", nil));
8619
b96b0141cb61 util.format: Fix tests to have expected value first
Kim Alvefur <zash@zash.se>
parents: 8383
diff changeset
13 assert.equal("true", format("%s", true));
b96b0141cb61 util.format: Fix tests to have expected value first
Kim Alvefur <zash@zash.se>
parents: 8383
diff changeset
14 assert.equal("[true]", format("%d", true));
b96b0141cb61 util.format: Fix tests to have expected value first
Kim Alvefur <zash@zash.se>
parents: 8383
diff changeset
15 assert.equal("% [true]", format("%%", true));
9693
6ed0d6224d64 util.format: Serialize values for the %q format
Kim Alvefur <zash@zash.se>
parents: 9656
diff changeset
16 assert.equal("{ }", format("%q", { }));
10034
4fca92d60040 util.format: Handle formats expecting an integer in Lua 5.3+ (fixes #1371)
Kim Alvefur <zash@zash.se>
parents: 9693
diff changeset
17 assert.equal("[1.5]", format("%d", 1.5));
10035
386f085820e6 util.format: Handle integer formats the same way on Lua versions without integer support
Kim Alvefur <zash@zash.se>
parents: 10034
diff changeset
18 assert.equal("[7.3786976294838e+19]", format("%d", 73786976294838206464));
8383
d967d6f2ad00 util.format: Move tests to spec/
Kim Alvefur <zash@zash.se>
parents:
diff changeset
19 end);
11638
5f4a657136bc util.format: Escape ASCII control characters in output
Kim Alvefur <zash@zash.se>
parents: 10035
diff changeset
20
5f4a657136bc util.format: Escape ASCII control characters in output
Kim Alvefur <zash@zash.se>
parents: 10035
diff changeset
21 it("escapes ascii control stuff", function ()
5f4a657136bc util.format: Escape ASCII control characters in output
Kim Alvefur <zash@zash.se>
parents: 10035
diff changeset
22 assert.equal("␁", format("%s", "\1"));
12032
3db09eb4c43b util.format: Ensure sanitation of strings passed to wrong format
Kim Alvefur <zash@zash.se>
parents: 12031
diff changeset
23 assert.equal("[␁]", format("%d", "\1"));
11638
5f4a657136bc util.format: Escape ASCII control characters in output
Kim Alvefur <zash@zash.se>
parents: 10035
diff changeset
24 end);
5f4a657136bc util.format: Escape ASCII control characters in output
Kim Alvefur <zash@zash.se>
parents: 10035
diff changeset
25
12031
87bc26f23d9b util.format: Escape invalid UTF-8 by passing trough serialization
Kim Alvefur <zash@zash.se>
parents: 11644
diff changeset
26 it("escapes invalid UTF-8", function ()
87bc26f23d9b util.format: Escape invalid UTF-8 by passing trough serialization
Kim Alvefur <zash@zash.se>
parents: 11644
diff changeset
27 assert.equal("\"Hello w\\195rld\"", format("%s", "Hello w\195rld"));
87bc26f23d9b util.format: Escape invalid UTF-8 by passing trough serialization
Kim Alvefur <zash@zash.se>
parents: 11644
diff changeset
28 end);
87bc26f23d9b util.format: Escape invalid UTF-8 by passing trough serialization
Kim Alvefur <zash@zash.se>
parents: 11644
diff changeset
29
12033
161f8268c4b3 util.format: Also handle the %p format added in Lua 5.4
Kim Alvefur <zash@zash.se>
parents: 12032
diff changeset
30 if _VERSION >= "Lua 5.4" then
161f8268c4b3 util.format: Also handle the %p format added in Lua 5.4
Kim Alvefur <zash@zash.se>
parents: 12032
diff changeset
31 it("handles %p formats", function ()
161f8268c4b3 util.format: Also handle the %p format added in Lua 5.4
Kim Alvefur <zash@zash.se>
parents: 12032
diff changeset
32 assert.matches("a 0x%x+ b", format("%s %p %s", "a", {}, "b"));
161f8268c4b3 util.format: Also handle the %p format added in Lua 5.4
Kim Alvefur <zash@zash.se>
parents: 12032
diff changeset
33 end)
161f8268c4b3 util.format: Also handle the %p format added in Lua 5.4
Kim Alvefur <zash@zash.se>
parents: 12032
diff changeset
34 else
161f8268c4b3 util.format: Also handle the %p format added in Lua 5.4
Kim Alvefur <zash@zash.se>
parents: 12032
diff changeset
35 it("does something with %p formats", function ()
161f8268c4b3 util.format: Also handle the %p format added in Lua 5.4
Kim Alvefur <zash@zash.se>
parents: 12032
diff changeset
36 assert.string(format("%p", {}));
161f8268c4b3 util.format: Also handle the %p format added in Lua 5.4
Kim Alvefur <zash@zash.se>
parents: 12032
diff changeset
37 end)
161f8268c4b3 util.format: Also handle the %p format added in Lua 5.4
Kim Alvefur <zash@zash.se>
parents: 12032
diff changeset
38 end
12034
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
39
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
40 -- Tests generated with loops!
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
41 describe("nil", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
42 describe("to %c", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
43 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
44 assert.equal("(nil)", format("%c", nil))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
45 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
46 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
47
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
48 describe("to %d", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
49 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
50 assert.equal("(nil)", format("%d", nil))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
51 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
52 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
53
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
54 describe("to %i", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
55 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
56 assert.equal("(nil)", format("%i", nil))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
57 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
58 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
59
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
60 describe("to %o", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
61 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
62 assert.equal("(nil)", format("%o", nil))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
63 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
64 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
65
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
66 describe("to %u", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
67 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
68 assert.equal("(nil)", format("%u", nil))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
69 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
70 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
71
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
72 describe("to %x", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
73 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
74 assert.equal("(nil)", format("%x", nil))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
75 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
76 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
77
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
78 describe("to %X", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
79 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
80 assert.equal("(nil)", format("%X", nil))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
81 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
82 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
83
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
84 describe("to %a", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
85 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
86 assert.equal("(nil)", format("%a", nil))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
87 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
88 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
89
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
90 describe("to %A", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
91 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
92 assert.equal("(nil)", format("%A", nil))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
93 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
94 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
95
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
96 describe("to %e", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
97 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
98 assert.equal("(nil)", format("%e", nil))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
99 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
100 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
101
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
102 describe("to %E", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
103 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
104 assert.equal("(nil)", format("%E", nil))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
105 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
106 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
107
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
108 describe("to %f", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
109 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
110 assert.equal("(nil)", format("%f", nil))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
111 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
112 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
113
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
114 describe("to %g", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
115 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
116 assert.equal("(nil)", format("%g", nil))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
117 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
118 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
119
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
120 describe("to %G", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
121 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
122 assert.equal("(nil)", format("%G", nil))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
123 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
124 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
125
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
126 describe("to %q", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
127 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
128 assert.equal("(nil)", format("%q", nil))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
129 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
130 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
131
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
132 describe("to %s", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
133 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
134 assert.equal("(nil)", format("%s", nil))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
135 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
136 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
137
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
138 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
139
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
140 describe("boolean", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
141 describe("to %c", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
142 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
143 assert.equal("[true]", format("%c", true))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
144 assert.equal("[false]", format("%c", false))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
145 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
146 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
147
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
148 describe("to %d", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
149 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
150 assert.equal("[true]", format("%d", true))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
151 assert.equal("[false]", format("%d", false))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
152 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
153 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
154
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
155 describe("to %i", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
156 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
157 assert.equal("[true]", format("%i", true))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
158 assert.equal("[false]", format("%i", false))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
159 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
160 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
161
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
162 describe("to %o", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
163 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
164 assert.equal("[true]", format("%o", true))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
165 assert.equal("[false]", format("%o", false))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
166 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
167 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
168
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
169 describe("to %u", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
170 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
171 assert.equal("[true]", format("%u", true))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
172 assert.equal("[false]", format("%u", false))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
173 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
174 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
175
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
176 describe("to %x", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
177 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
178 assert.equal("[true]", format("%x", true))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
179 assert.equal("[false]", format("%x", false))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
180 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
181 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
182
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
183 describe("to %X", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
184 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
185 assert.equal("[true]", format("%X", true))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
186 assert.equal("[false]", format("%X", false))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
187 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
188 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
189
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
190 describe("to %a", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
191 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
192 assert.equal("[true]", format("%a", true))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
193 assert.equal("[false]", format("%a", false))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
194 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
195 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
196
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
197 describe("to %A", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
198 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
199 assert.equal("[true]", format("%A", true))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
200 assert.equal("[false]", format("%A", false))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
201 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
202 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
203
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
204 describe("to %e", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
205 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
206 assert.equal("[true]", format("%e", true))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
207 assert.equal("[false]", format("%e", false))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
208 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
209 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
210
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
211 describe("to %E", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
212 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
213 assert.equal("[true]", format("%E", true))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
214 assert.equal("[false]", format("%E", false))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
215 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
216 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
217
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
218 describe("to %f", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
219 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
220 assert.equal("[true]", format("%f", true))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
221 assert.equal("[false]", format("%f", false))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
222 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
223 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
224
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
225 describe("to %g", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
226 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
227 assert.equal("[true]", format("%g", true))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
228 assert.equal("[false]", format("%g", false))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
229 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
230 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
231
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
232 describe("to %G", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
233 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
234 assert.equal("[true]", format("%G", true))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
235 assert.equal("[false]", format("%G", false))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
236 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
237 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
238
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
239 describe("to %q", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
240 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
241 assert.equal("true", format("%q", true))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
242 assert.equal("false", format("%q", false))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
243 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
244 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
245
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
246 describe("to %s", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
247 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
248 assert.equal("true", format("%s", true))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
249 assert.equal("false", format("%s", false))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
250 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
251 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
252
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
253 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
254
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
255 describe("number", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
256 describe("to %c", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
257 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
258 assert.equal("a", format("%c", 97))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
259 assert.equal("[1.5]", format("%c", 1.5))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
260 assert.equal("[7.3786976294838e+19]", format("%c", 73786976294838206464))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
261 assert.equal("[inf]", format("%c", math.huge))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
262 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
263 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
264
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
265 describe("to %d", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
266 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
267 assert.equal("97", format("%d", 97))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
268 assert.equal("-12345", format("%d", -12345))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
269 assert.equal("[1.5]", format("%d", 1.5))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
270 assert.equal("[7.3786976294838e+19]", format("%d", 73786976294838206464))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
271 assert.equal("[inf]", format("%d", math.huge))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
272 assert.equal("2147483647", format("%d", 2147483647))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
273 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
274 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
275
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
276 describe("to %i", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
277 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
278 assert.equal("97", format("%i", 97))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
279 assert.equal("-12345", format("%i", -12345))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
280 assert.equal("[1.5]", format("%i", 1.5))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
281 assert.equal("[7.3786976294838e+19]", format("%i", 73786976294838206464))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
282 assert.equal("[inf]", format("%i", math.huge))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
283 assert.equal("2147483647", format("%i", 2147483647))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
284 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
285 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
286
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
287 describe("to %o", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
288 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
289 assert.equal("141", format("%o", 97))
12036
2ce06f788093 util.format: Fix some formats expecting positive numbers in Lua 5.2
Kim Alvefur <zash@zash.se>
parents: 12034
diff changeset
290 assert.equal("[-12345]", format("%o", -12345))
12034
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
291 assert.equal("[1.5]", format("%o", 1.5))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
292 assert.equal("[7.3786976294838e+19]", format("%o", 73786976294838206464))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
293 assert.equal("[inf]", format("%o", math.huge))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
294 assert.equal("17777777777", format("%o", 2147483647))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
295 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
296 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
297
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
298 describe("to %u", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
299 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
300 assert.equal("97", format("%u", 97))
12036
2ce06f788093 util.format: Fix some formats expecting positive numbers in Lua 5.2
Kim Alvefur <zash@zash.se>
parents: 12034
diff changeset
301 assert.equal("[-12345]", format("%u", -12345))
12034
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
302 assert.equal("[1.5]", format("%u", 1.5))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
303 assert.equal("[7.3786976294838e+19]", format("%u", 73786976294838206464))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
304 assert.equal("[inf]", format("%u", math.huge))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
305 assert.equal("2147483647", format("%u", 2147483647))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
306 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
307 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
308
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
309 describe("to %x", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
310 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
311 assert.equal("61", format("%x", 97))
12036
2ce06f788093 util.format: Fix some formats expecting positive numbers in Lua 5.2
Kim Alvefur <zash@zash.se>
parents: 12034
diff changeset
312 assert.equal("[-12345]", format("%x", -12345))
12034
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
313 assert.equal("[1.5]", format("%x", 1.5))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
314 assert.equal("[7.3786976294838e+19]", format("%x", 73786976294838206464))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
315 assert.equal("[inf]", format("%x", math.huge))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
316 assert.equal("7fffffff", format("%x", 2147483647))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
317 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
318 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
319
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
320 describe("to %X", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
321 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
322 assert.equal("61", format("%X", 97))
12036
2ce06f788093 util.format: Fix some formats expecting positive numbers in Lua 5.2
Kim Alvefur <zash@zash.se>
parents: 12034
diff changeset
323 assert.equal("[-12345]", format("%X", -12345))
12034
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
324 assert.equal("[1.5]", format("%X", 1.5))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
325 assert.equal("[7.3786976294838e+19]", format("%X", 73786976294838206464))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
326 assert.equal("[inf]", format("%X", math.huge))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
327 assert.equal("7FFFFFFF", format("%X", 2147483647))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
328 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
329 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
330
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
331 if _VERSION > "Lua 5.1" then -- COMPAT no %a or %A in Lua 5.1
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
332 describe("to %a", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
333 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
334 assert.equal("0x1.84p+6", format("%a", 97))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
335 assert.equal("-0x1.81c8p+13", format("%a", -12345))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
336 assert.equal("0x1.8p+0", format("%a", 1.5))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
337 assert.equal("0x1p+66", format("%a", 73786976294838206464))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
338 assert.equal("inf", format("%a", math.huge))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
339 assert.equal("0x1.fffffffcp+30", format("%a", 2147483647))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
340 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
341 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
342
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
343 describe("to %A", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
344 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
345 assert.equal("0X1.84P+6", format("%A", 97))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
346 assert.equal("-0X1.81C8P+13", format("%A", -12345))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
347 assert.equal("0X1.8P+0", format("%A", 1.5))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
348 assert.equal("0X1P+66", format("%A", 73786976294838206464))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
349 assert.equal("INF", format("%A", math.huge))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
350 assert.equal("0X1.FFFFFFFCP+30", format("%A", 2147483647))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
351 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
352 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
353 end
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
354
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
355 describe("to %e", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
356 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
357 assert.equal("9.700000e+01", format("%e", 97))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
358 assert.equal("-1.234500e+04", format("%e", -12345))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
359 assert.equal("1.500000e+00", format("%e", 1.5))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
360 assert.equal("7.378698e+19", format("%e", 73786976294838206464))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
361 assert.equal("inf", format("%e", math.huge))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
362 assert.equal("2.147484e+09", format("%e", 2147483647))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
363 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
364 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
365
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
366 describe("to %E", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
367 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
368 assert.equal("9.700000E+01", format("%E", 97))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
369 assert.equal("-1.234500E+04", format("%E", -12345))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
370 assert.equal("1.500000E+00", format("%E", 1.5))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
371 assert.equal("7.378698E+19", format("%E", 73786976294838206464))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
372 assert.equal("INF", format("%E", math.huge))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
373 assert.equal("2.147484E+09", format("%E", 2147483647))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
374 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
375 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
376
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
377 describe("to %f", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
378 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
379 assert.equal("97.000000", format("%f", 97))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
380 assert.equal("-12345.000000", format("%f", -12345))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
381 assert.equal("1.500000", format("%f", 1.5))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
382 assert.equal("73786976294838206464.000000", format("%f", 73786976294838206464))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
383 assert.equal("inf", format("%f", math.huge))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
384 assert.equal("2147483647.000000", format("%f", 2147483647))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
385 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
386 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
387
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
388 describe("to %g", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
389 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
390 assert.equal("97", format("%g", 97))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
391 assert.equal("-12345", format("%g", -12345))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
392 assert.equal("1.5", format("%g", 1.5))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
393 assert.equal("7.3787e+19", format("%g", 73786976294838206464))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
394 assert.equal("inf", format("%g", math.huge))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
395 assert.equal("2.14748e+09", format("%g", 2147483647))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
396 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
397 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
398
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
399 describe("to %G", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
400 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
401 assert.equal("97", format("%G", 97))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
402 assert.equal("-12345", format("%G", -12345))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
403 assert.equal("1.5", format("%G", 1.5))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
404 assert.equal("7.3787E+19", format("%G", 73786976294838206464))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
405 assert.equal("INF", format("%G", math.huge))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
406 assert.equal("2.14748E+09", format("%G", 2147483647))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
407 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
408 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
409
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
410 describe("to %q", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
411 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
412 assert.equal("97", format("%q", 97))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
413 assert.equal("-12345", format("%q", -12345))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
414 assert.equal("1.5", format("%q", 1.5))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
415 assert.equal("7.37869762948382065e+19", format("%q", 73786976294838206464))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
416 assert.equal("(1/0)", format("%q", math.huge))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
417 assert.equal("2147483647", format("%q", 2147483647))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
418 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
419 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
420
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
421 describe("to %s", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
422 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
423 assert.equal("97", format("%s", 97))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
424 assert.equal("-12345", format("%s", -12345))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
425 assert.equal("1.5", format("%s", 1.5))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
426 assert.equal("7.3786976294838e+19", format("%s", 73786976294838206464))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
427 assert.equal("inf", format("%s", math.huge))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
428 assert.equal("2147483647", format("%s", 2147483647))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
429 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
430 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
431
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
432 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
433
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
434 describe("string", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
435 describe("to %c", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
436 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
437 assert.equal("[hello]", format("%c", "hello"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
438 assert.equal("[foo \226\144\129\226\144\130\226\144\131 bar]", format("%c", "foo \001\002\003 bar"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
439 assert.equal("[nödåtgärd]", format("%c", "n\195\182d\195\165tg\195\164rd"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
440 assert.equal("\"n\\195\\182d\\195\\165tg\\195\"", format("%c", "n\195\182d\195\165tg\195"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
441 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
442 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
443
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
444 describe("to %d", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
445 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
446 assert.equal("[hello]", format("%d", "hello"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
447 assert.equal("[foo \226\144\129\226\144\130\226\144\131 bar]", format("%d", "foo \001\002\003 bar"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
448 assert.equal("[nödåtgärd]", format("%d", "n\195\182d\195\165tg\195\164rd"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
449 assert.equal("\"n\\195\\182d\\195\\165tg\\195\"", format("%d", "n\195\182d\195\165tg\195"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
450 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
451 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
452
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
453 describe("to %i", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
454 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
455 assert.equal("[hello]", format("%i", "hello"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
456 assert.equal("[foo \226\144\129\226\144\130\226\144\131 bar]", format("%i", "foo \001\002\003 bar"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
457 assert.equal("[nödåtgärd]", format("%i", "n\195\182d\195\165tg\195\164rd"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
458 assert.equal("\"n\\195\\182d\\195\\165tg\\195\"", format("%i", "n\195\182d\195\165tg\195"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
459 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
460 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
461
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
462 describe("to %o", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
463 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
464 assert.equal("[hello]", format("%o", "hello"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
465 assert.equal("[foo \226\144\129\226\144\130\226\144\131 bar]", format("%o", "foo \001\002\003 bar"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
466 assert.equal("[nödåtgärd]", format("%o", "n\195\182d\195\165tg\195\164rd"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
467 assert.equal("\"n\\195\\182d\\195\\165tg\\195\"", format("%o", "n\195\182d\195\165tg\195"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
468 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
469 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
470
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
471 describe("to %u", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
472 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
473 assert.equal("[hello]", format("%u", "hello"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
474 assert.equal("[foo \226\144\129\226\144\130\226\144\131 bar]", format("%u", "foo \001\002\003 bar"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
475 assert.equal("[nödåtgärd]", format("%u", "n\195\182d\195\165tg\195\164rd"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
476 assert.equal("\"n\\195\\182d\\195\\165tg\\195\"", format("%u", "n\195\182d\195\165tg\195"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
477 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
478 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
479
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
480 describe("to %x", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
481 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
482 assert.equal("[hello]", format("%x", "hello"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
483 assert.equal("[foo \226\144\129\226\144\130\226\144\131 bar]", format("%x", "foo \001\002\003 bar"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
484 assert.equal("[nödåtgärd]", format("%x", "n\195\182d\195\165tg\195\164rd"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
485 assert.equal("\"n\\195\\182d\\195\\165tg\\195\"", format("%x", "n\195\182d\195\165tg\195"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
486 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
487 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
488
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
489 describe("to %X", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
490 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
491 assert.equal("[hello]", format("%X", "hello"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
492 assert.equal("[foo \226\144\129\226\144\130\226\144\131 bar]", format("%X", "foo \001\002\003 bar"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
493 assert.equal("[nödåtgärd]", format("%X", "n\195\182d\195\165tg\195\164rd"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
494 assert.equal("\"n\\195\\182d\\195\\165tg\\195\"", format("%X", "n\195\182d\195\165tg\195"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
495 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
496 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
497
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
498 describe("to %a", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
499 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
500 assert.equal("[hello]", format("%a", "hello"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
501 assert.equal("[foo \226\144\129\226\144\130\226\144\131 bar]", format("%a", "foo \001\002\003 bar"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
502 assert.equal("[nödåtgärd]", format("%a", "n\195\182d\195\165tg\195\164rd"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
503 assert.equal("\"n\\195\\182d\\195\\165tg\\195\"", format("%a", "n\195\182d\195\165tg\195"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
504 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
505 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
506
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
507 describe("to %A", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
508 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
509 assert.equal("[hello]", format("%A", "hello"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
510 assert.equal("[foo \226\144\129\226\144\130\226\144\131 bar]", format("%A", "foo \001\002\003 bar"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
511 assert.equal("[nödåtgärd]", format("%A", "n\195\182d\195\165tg\195\164rd"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
512 assert.equal("\"n\\195\\182d\\195\\165tg\\195\"", format("%A", "n\195\182d\195\165tg\195"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
513 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
514 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
515
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
516 describe("to %e", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
517 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
518 assert.equal("[hello]", format("%e", "hello"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
519 assert.equal("[foo \226\144\129\226\144\130\226\144\131 bar]", format("%e", "foo \001\002\003 bar"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
520 assert.equal("[nödåtgärd]", format("%e", "n\195\182d\195\165tg\195\164rd"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
521 assert.equal("\"n\\195\\182d\\195\\165tg\\195\"", format("%e", "n\195\182d\195\165tg\195"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
522 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
523 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
524
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
525 describe("to %E", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
526 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
527 assert.equal("[hello]", format("%E", "hello"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
528 assert.equal("[foo \226\144\129\226\144\130\226\144\131 bar]", format("%E", "foo \001\002\003 bar"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
529 assert.equal("[nödåtgärd]", format("%E", "n\195\182d\195\165tg\195\164rd"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
530 assert.equal("\"n\\195\\182d\\195\\165tg\\195\"", format("%E", "n\195\182d\195\165tg\195"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
531 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
532 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
533
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
534 describe("to %f", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
535 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
536 assert.equal("[hello]", format("%f", "hello"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
537 assert.equal("[foo \226\144\129\226\144\130\226\144\131 bar]", format("%f", "foo \001\002\003 bar"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
538 assert.equal("[nödåtgärd]", format("%f", "n\195\182d\195\165tg\195\164rd"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
539 assert.equal("\"n\\195\\182d\\195\\165tg\\195\"", format("%f", "n\195\182d\195\165tg\195"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
540 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
541 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
542
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
543 describe("to %g", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
544 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
545 assert.equal("[hello]", format("%g", "hello"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
546 assert.equal("[foo \226\144\129\226\144\130\226\144\131 bar]", format("%g", "foo \001\002\003 bar"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
547 assert.equal("[nödåtgärd]", format("%g", "n\195\182d\195\165tg\195\164rd"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
548 assert.equal("\"n\\195\\182d\\195\\165tg\\195\"", format("%g", "n\195\182d\195\165tg\195"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
549 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
550 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
551
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
552 describe("to %G", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
553 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
554 assert.equal("[hello]", format("%G", "hello"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
555 assert.equal("[foo \226\144\129\226\144\130\226\144\131 bar]", format("%G", "foo \001\002\003 bar"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
556 assert.equal("[nödåtgärd]", format("%G", "n\195\182d\195\165tg\195\164rd"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
557 assert.equal("\"n\\195\\182d\\195\\165tg\\195\"", format("%G", "n\195\182d\195\165tg\195"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
558 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
559 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
560
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
561 describe("to %q", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
562 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
563 assert.equal("\"hello\"", format("%q", "hello"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
564 assert.equal("\"foo \226\144\129\226\144\130\226\144\131 bar\"", format("%q", "foo \001\002\003 bar"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
565 assert.equal("\"nödåtgärd\"", format("%q", "n\195\182d\195\165tg\195\164rd"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
566 assert.equal("\"n\\195\\182d\\195\\165tg\\195\"", format("%q", "n\195\182d\195\165tg\195"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
567 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
568 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
569
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
570 describe("to %s", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
571 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
572 assert.equal("hello", format("%s", "hello"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
573 assert.equal("foo \226\144\129\226\144\130\226\144\131 bar", format("%s", "foo \001\002\003 bar"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
574 assert.equal("nödåtgärd", format("%s", "n\195\182d\195\165tg\195\164rd"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
575 assert.equal("\"n\\195\\182d\\195\\165tg\\195\"", format("%s", "n\195\182d\195\165tg\195"))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
576 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
577 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
578
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
579 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
580
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
581 describe("function", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
582 describe("to %c", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
583 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
584 assert.matches("[function: 0[xX]%x+]", format("%c", function() end))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
585 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
586 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
587
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
588 describe("to %d", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
589 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
590 assert.matches("[function: 0[xX]%x+]", format("%d", function() end))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
591 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
592 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
593
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
594 describe("to %i", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
595 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
596 assert.matches("[function: 0[xX]%x+]", format("%i", function() end))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
597 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
598 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
599
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
600 describe("to %o", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
601 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
602 assert.matches("[function: 0[xX]%x+]", format("%o", function() end))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
603 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
604 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
605
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
606 describe("to %u", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
607 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
608 assert.matches("[function: 0[xX]%x+]", format("%u", function() end))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
609 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
610 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
611
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
612 describe("to %x", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
613 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
614 assert.matches("[function: 0[xX]%x+]", format("%x", function() end))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
615 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
616 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
617
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
618 describe("to %X", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
619 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
620 assert.matches("[function: 0[xX]%x+]", format("%X", function() end))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
621 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
622 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
623
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
624 describe("to %a", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
625 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
626 assert.matches("[function: 0[xX]%x+]", format("%a", function() end))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
627 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
628 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
629
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
630 describe("to %A", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
631 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
632 assert.matches("[function: 0[xX]%x+]", format("%A", function() end))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
633 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
634 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
635
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
636 describe("to %e", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
637 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
638 assert.matches("[function: 0[xX]%x+]", format("%e", function() end))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
639 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
640 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
641
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
642 describe("to %E", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
643 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
644 assert.matches("[function: 0[xX]%x+]", format("%E", function() end))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
645 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
646 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
647
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
648 describe("to %f", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
649 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
650 assert.matches("[function: 0[xX]%x+]", format("%f", function() end))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
651 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
652 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
653
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
654 describe("to %g", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
655 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
656 assert.matches("[function: 0[xX]%x+]", format("%g", function() end))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
657 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
658 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
659
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
660 describe("to %G", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
661 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
662 assert.matches("[function: 0[xX]%x+]", format("%G", function() end))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
663 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
664 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
665
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
666 describe("to %q", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
667 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
668 assert.matches('{__type="function",__error="fail"}', format("%q", function() end))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
669 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
670 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
671
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
672 describe("to %s", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
673 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
674 assert.matches("function: 0[xX]%x+", format("%s", function() end))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
675 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
676 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
677
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
678 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
679
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
680 describe("thread", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
681 describe("to %c", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
682 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
683 assert.matches("[thread: 0[xX]%x+]", format("%c", coroutine.create(function() end)))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
684 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
685 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
686
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
687 describe("to %d", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
688 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
689 assert.matches("[thread: 0[xX]%x+]", format("%d", coroutine.create(function() end)))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
690 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
691 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
692
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
693 describe("to %i", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
694 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
695 assert.matches("[thread: 0[xX]%x+]", format("%i", coroutine.create(function() end)))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
696 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
697 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
698
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
699 describe("to %o", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
700 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
701 assert.matches("[thread: 0[xX]%x+]", format("%o", coroutine.create(function() end)))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
702 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
703 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
704
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
705 describe("to %u", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
706 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
707 assert.matches("[thread: 0[xX]%x+]", format("%u", coroutine.create(function() end)))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
708 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
709 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
710
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
711 describe("to %x", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
712 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
713 assert.matches("[thread: 0[xX]%x+]", format("%x", coroutine.create(function() end)))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
714 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
715 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
716
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
717 describe("to %X", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
718 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
719 assert.matches("[thread: 0[xX]%x+]", format("%X", coroutine.create(function() end)))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
720 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
721 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
722
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
723 describe("to %a", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
724 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
725 assert.matches("[thread: 0[xX]%x+]", format("%a", coroutine.create(function() end)))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
726 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
727 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
728
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
729 describe("to %A", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
730 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
731 assert.matches("[thread: 0[xX]%x+]", format("%A", coroutine.create(function() end)))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
732 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
733 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
734
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
735 describe("to %e", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
736 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
737 assert.matches("[thread: 0[xX]%x+]", format("%e", coroutine.create(function() end)))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
738 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
739 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
740
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
741 describe("to %E", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
742 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
743 assert.matches("[thread: 0[xX]%x+]", format("%E", coroutine.create(function() end)))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
744 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
745 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
746
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
747 describe("to %f", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
748 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
749 assert.matches("[thread: 0[xX]%x+]", format("%f", coroutine.create(function() end)))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
750 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
751 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
752
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
753 describe("to %g", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
754 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
755 assert.matches("[thread: 0[xX]%x+]", format("%g", coroutine.create(function() end)))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
756 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
757 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
758
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
759 describe("to %G", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
760 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
761 assert.matches("[thread: 0[xX]%x+]", format("%G", coroutine.create(function() end)))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
762 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
763 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
764
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
765 describe("to %q", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
766 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
767 assert.matches('{__type="thread",__error="fail"}', format("%q", coroutine.create(function() end)))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
768 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
769 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
770
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
771 describe("to %s", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
772 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
773 assert.matches("thread: 0[xX]%x+", format("%s", coroutine.create(function() end)))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
774 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
775 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
776
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
777 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
778
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
779 describe("table", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
780 describe("to %c", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
781 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
782 assert.matches("[table: 0[xX]%x+]", format("%c", { }))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
783 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
784 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
785
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
786 describe("to %d", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
787 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
788 assert.matches("[table: 0[xX]%x+]", format("%d", { }))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
789 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
790 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
791
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
792 describe("to %i", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
793 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
794 assert.matches("[table: 0[xX]%x+]", format("%i", { }))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
795 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
796 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
797
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
798 describe("to %o", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
799 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
800 assert.matches("[table: 0[xX]%x+]", format("%o", { }))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
801 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
802 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
803
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
804 describe("to %u", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
805 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
806 assert.matches("[table: 0[xX]%x+]", format("%u", { }))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
807 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
808 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
809
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
810 describe("to %x", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
811 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
812 assert.matches("[table: 0[xX]%x+]", format("%x", { }))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
813 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
814 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
815
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
816 describe("to %X", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
817 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
818 assert.matches("[table: 0[xX]%x+]", format("%X", { }))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
819 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
820 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
821
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
822 describe("to %a", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
823 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
824 assert.matches("[table: 0[xX]%x+]", format("%a", { }))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
825 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
826 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
827
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
828 describe("to %A", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
829 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
830 assert.matches("[table: 0[xX]%x+]", format("%A", { }))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
831 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
832 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
833
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
834 describe("to %e", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
835 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
836 assert.matches("[table: 0[xX]%x+]", format("%e", { }))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
837 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
838 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
839
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
840 describe("to %E", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
841 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
842 assert.matches("[table: 0[xX]%x+]", format("%E", { }))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
843 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
844 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
845
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
846 describe("to %f", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
847 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
848 assert.matches("[table: 0[xX]%x+]", format("%f", { }))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
849 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
850 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
851
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
852 describe("to %g", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
853 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
854 assert.matches("[table: 0[xX]%x+]", format("%g", { }))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
855 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
856 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
857
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
858 describe("to %G", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
859 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
860 assert.matches("[table: 0[xX]%x+]", format("%G", { }))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
861 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
862 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
863
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
864 describe("to %q", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
865 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
866 assert.matches("{ }", format("%q", { }))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
867 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
868 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
869
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
870 describe("to %s", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
871 it("works", function ()
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
872 assert.matches("table: 0[xX]%x+", format("%s", { }))
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
873 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
874 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
875
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
876 end);
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
877
ee94ac51b2dd util.format: ALL THE TESTS!!!
Kim Alvefur <zash@zash.se>
parents: 12033
diff changeset
878
8383
d967d6f2ad00 util.format: Move tests to spec/
Kim Alvefur <zash@zash.se>
parents:
diff changeset
879 end);
d967d6f2ad00 util.format: Move tests to spec/
Kim Alvefur <zash@zash.se>
parents:
diff changeset
880 end);