mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-28 00:02:28 +00:00
Revert whitespace fixes to third_party (#501)
This commit is contained in:
parent
d4000bb8f7
commit
9de3d8f1e6
365 changed files with 39190 additions and 39211 deletions
2
third_party/lua/test/attrib.lua
vendored
2
third_party/lua/test/attrib.lua
vendored
|
@ -435,7 +435,7 @@ a.aVeryLongName012345678901234567890123456789012345678901234567890123456789 ==
|
|||
|
||||
|
||||
|
||||
-- test of large float/integer indices
|
||||
-- test of large float/integer indices
|
||||
|
||||
-- compute maximum integer where all bits fit in a float
|
||||
local maxint = math.maxinteger
|
||||
|
|
6
third_party/lua/test/big.lua
vendored
6
third_party/lua/test/big.lua
vendored
|
@ -7,7 +7,7 @@ end
|
|||
|
||||
print "testing large tables"
|
||||
|
||||
local debug = require"debug"
|
||||
local debug = require"debug"
|
||||
|
||||
local lim = 2^18 + 1000
|
||||
local prog = { "local y = {0" }
|
||||
|
@ -46,7 +46,7 @@ getmetatable(env).__newindex = function () end
|
|||
local e, m = pcall(f)
|
||||
assert(not e and m:find("global 'X'"))
|
||||
|
||||
-- errors in metamethods
|
||||
-- errors in metamethods
|
||||
getmetatable(env).__newindex = function () error("hi") end
|
||||
local e, m = xpcall(f, debug.traceback)
|
||||
assert(not e and m:find("'newindex'"))
|
||||
|
@ -55,7 +55,7 @@ f, X = nil
|
|||
|
||||
coroutine.yield'b'
|
||||
|
||||
if 2^32 == 0 then -- (small integers) {
|
||||
if 2^32 == 0 then -- (small integers) {
|
||||
|
||||
print "testing string length overflow"
|
||||
|
||||
|
|
4
third_party/lua/test/closure.lua
vendored
4
third_party/lua/test/closure.lua
vendored
|
@ -162,7 +162,7 @@ do
|
|||
X = function () return b end -- closure with upvalue
|
||||
if a then break end
|
||||
end
|
||||
|
||||
|
||||
do
|
||||
local b = 20
|
||||
Y = function () return b end -- closure with upvalue
|
||||
|
@ -172,7 +172,7 @@ do
|
|||
assert(X() == 10 and Y() == 20)
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- testing closures x repeat-until
|
||||
|
||||
local a = {}
|
||||
|
|
12
third_party/lua/test/coroutine.lua
vendored
12
third_party/lua/test/coroutine.lua
vendored
|
@ -467,7 +467,7 @@ else
|
|||
print "testing yields inside hooks"
|
||||
|
||||
local turn
|
||||
|
||||
|
||||
function fact (t, x)
|
||||
assert(turn == t)
|
||||
if x == 0 then return 1
|
||||
|
@ -591,7 +591,7 @@ else
|
|||
|
||||
|
||||
print "testing coroutine API"
|
||||
|
||||
|
||||
-- reusing a thread
|
||||
assert(T.testC([[
|
||||
newthread # create thread
|
||||
|
@ -870,7 +870,7 @@ do -- a few more tests for comparison operators
|
|||
until res ~= 10
|
||||
return res
|
||||
end
|
||||
|
||||
|
||||
local function test ()
|
||||
local a1 = setmetatable({x=1}, mt1)
|
||||
local a2 = setmetatable({x=2}, mt2)
|
||||
|
@ -882,7 +882,7 @@ do -- a few more tests for comparison operators
|
|||
assert(2 >= a2)
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
run(test)
|
||||
|
||||
end
|
||||
|
@ -1042,11 +1042,11 @@ co = coroutine.wrap(function (...) return
|
|||
cannot be here!
|
||||
]],
|
||||
[[ # 1st continuation
|
||||
yieldk 0 3
|
||||
yieldk 0 3
|
||||
cannot be here!
|
||||
]],
|
||||
[[ # 2nd continuation
|
||||
yieldk 0 4
|
||||
yieldk 0 4
|
||||
cannot be here!
|
||||
]],
|
||||
[[ # 3th continuation
|
||||
|
|
14
third_party/lua/test/db.lua
vendored
14
third_party/lua/test/db.lua
vendored
|
@ -359,7 +359,7 @@ end
|
|||
function g(a,b) return (a+1) + f() end
|
||||
|
||||
assert(g(0,0) == 30)
|
||||
|
||||
|
||||
|
||||
debug.sethook(nil);
|
||||
assert(not debug.gethook())
|
||||
|
@ -411,7 +411,7 @@ debug.sethook(function (e)
|
|||
dostring("XX = 12") -- test dostring inside hooks
|
||||
-- testing errors inside hooks
|
||||
assert(not pcall(load("a='joao'+1")))
|
||||
debug.sethook(function (e, l)
|
||||
debug.sethook(function (e, l)
|
||||
assert(debug.getinfo(2, "l").currentline == l)
|
||||
local f,m,c = debug.gethook()
|
||||
assert(e == "line")
|
||||
|
@ -474,7 +474,7 @@ do print("testing inspection of parameters/returned values")
|
|||
local t = {}
|
||||
for i = ar.ftransfer, ar.ftransfer + ar.ntransfer - 1 do
|
||||
local _, v = debug.getlocal(2, i)
|
||||
t[#t + 1] = v
|
||||
t[#t + 1] = v
|
||||
end
|
||||
if event == "return" then
|
||||
out = t
|
||||
|
@ -528,7 +528,7 @@ assert(t.a == 1 and t.b == 2 and t.c == 3)
|
|||
assert(debug.setupvalue(foo1, 1, "xuxu") == "b")
|
||||
assert(({debug.getupvalue(foo2, 3)})[2] == "xuxu")
|
||||
-- upvalues of C functions are allways "called" "" (the empty string)
|
||||
assert(debug.getupvalue(string.gmatch("x", "x"), 1) == "")
|
||||
assert(debug.getupvalue(string.gmatch("x", "x"), 1) == "")
|
||||
|
||||
|
||||
-- testing count hooks
|
||||
|
@ -960,7 +960,7 @@ end
|
|||
do -- tests for 'source' in binary dumps
|
||||
local prog = [[
|
||||
return function (x)
|
||||
return function (y)
|
||||
return function (y)
|
||||
return x + y
|
||||
end
|
||||
end
|
||||
|
@ -975,7 +975,7 @@ do -- tests for 'source' in binary dumps
|
|||
local h = g(3)
|
||||
assert(h(5) == 8)
|
||||
assert(debug.getinfo(f).source == name and -- all functions have 'source'
|
||||
debug.getinfo(g).source == name and
|
||||
debug.getinfo(g).source == name and
|
||||
debug.getinfo(h).source == name)
|
||||
-- again, without debug info
|
||||
local c = string.dump(p, true)
|
||||
|
@ -985,7 +985,7 @@ do -- tests for 'source' in binary dumps
|
|||
local h = g(30)
|
||||
assert(h(50) == 80)
|
||||
assert(debug.getinfo(f).source == '=?' and -- no function has 'source'
|
||||
debug.getinfo(g).source == '=?' and
|
||||
debug.getinfo(g).source == '=?' and
|
||||
debug.getinfo(h).source == '=?')
|
||||
end
|
||||
|
||||
|
|
4
third_party/lua/test/errors.lua
vendored
4
third_party/lua/test/errors.lua
vendored
|
@ -493,7 +493,7 @@ if not _soft then
|
|||
f(3)
|
||||
|
||||
local function loop (x,y,z) return 1 + loop(x, y, z) end
|
||||
|
||||
|
||||
local res, msg = xpcall(loop, function (m)
|
||||
assert(string.find(m, "stack overflow"))
|
||||
checkerr("error handling", loop)
|
||||
|
@ -526,7 +526,7 @@ do
|
|||
-- 'assert' with extra arguments
|
||||
res, msg = pcall(assert, false, "X", t)
|
||||
assert(not res and msg == "X")
|
||||
|
||||
|
||||
-- 'assert' with no message
|
||||
res, msg = pcall(function () assert(false) end)
|
||||
local line = string.match(msg, "%w+%.lua:(%d+): assertion failed!$")
|
||||
|
|
4
third_party/lua/test/heavy.lua
vendored
4
third_party/lua/test/heavy.lua
vendored
|
@ -74,7 +74,7 @@ end
|
|||
function hugeid ()
|
||||
print("loading chunk with huge identifier")
|
||||
local st, msg = loadrep("a", "chars")
|
||||
assert(not st and
|
||||
assert(not st and
|
||||
(string.find(msg, "lexical element too long") or
|
||||
string.find(msg, "not enough memory")))
|
||||
print('+')
|
||||
|
@ -158,7 +158,7 @@ function toomanyidx ()
|
|||
print("expected error: ", msg)
|
||||
print("size:", #a)
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
-- teststring()
|
||||
|
|
2
third_party/lua/test/libs/lib1.c
vendored
2
third_party/lua/test/libs/lib1.c
vendored
|
@ -32,7 +32,7 @@ LUAMOD_API int anotherfunc (lua_State *L) {
|
|||
lua_pushfstring(L, "%d%%%d\n", (int)lua_tointeger(L, 1),
|
||||
(int)lua_tointeger(L, 2));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LUAMOD_API int luaopen_lib1_sub (lua_State *L) {
|
||||
|
|
4
third_party/lua/test/math.lua
vendored
4
third_party/lua/test/math.lua
vendored
|
@ -140,7 +140,7 @@ assert(eqT(3.5 // 1.5, 2.0))
|
|||
assert(eqT(3.5 // -1.5, -3.0))
|
||||
|
||||
do -- tests for different kinds of opcodes
|
||||
local x, y
|
||||
local x, y
|
||||
x = 1; assert(x // 0.0 == 1/0)
|
||||
x = 1.0; assert(x // 0 == 1/0)
|
||||
x = 3.5; assert(eqT(x // 1, 3.0))
|
||||
|
@ -618,7 +618,7 @@ assert(minint % -1 == 0)
|
|||
assert(minint % -2 == 0)
|
||||
assert(maxint % -2 == -1)
|
||||
|
||||
-- non-portable tests because Windows C library cannot compute
|
||||
-- non-portable tests because Windows C library cannot compute
|
||||
-- fmod(1, huge) correctly
|
||||
if not _port then
|
||||
local function anan (x) assert(isNaN(x)) end -- assert Not a Number
|
||||
|
|
6
third_party/lua/test/sort.lua
vendored
6
third_party/lua/test/sort.lua
vendored
|
@ -79,7 +79,7 @@ end
|
|||
print "testing pack"
|
||||
|
||||
a = table.pack()
|
||||
assert(a[1] == undef and a.n == 0)
|
||||
assert(a[1] == undef and a.n == 0)
|
||||
|
||||
a = table.pack(table)
|
||||
assert(a[1] == table and a.n == 1)
|
||||
|
@ -94,8 +94,8 @@ do
|
|||
checkerror("table expected", table.move, 1, 2, 3, 4)
|
||||
|
||||
local function eqT (a, b)
|
||||
for k, v in pairs(a) do assert(b[k] == v) end
|
||||
for k, v in pairs(b) do assert(a[k] == v) end
|
||||
for k, v in pairs(a) do assert(b[k] == v) end
|
||||
for k, v in pairs(b) do assert(a[k] == v) end
|
||||
end
|
||||
|
||||
local a = table.move({10,20,30}, 1, 3, 2) -- move forward
|
||||
|
|
2
third_party/lua/test/strings.lua
vendored
2
third_party/lua/test/strings.lua
vendored
|
@ -331,7 +331,7 @@ do print("testing 'format %a %A'")
|
|||
assert(string.find(string.format("%a", 0/0), "^%-?nan"))
|
||||
assert(string.find(string.format("%a", -0.0), "^%-0x0"))
|
||||
end
|
||||
|
||||
|
||||
if not pcall(string.format, "%.3a", 0) then
|
||||
(Message or print)("\n >>> modifiers for format '%a' not available <<<\n")
|
||||
else
|
||||
|
|
8
third_party/lua/test/tpack.lua
vendored
8
third_party/lua/test/tpack.lua
vendored
|
@ -173,7 +173,7 @@ else
|
|||
assert(pack("f", 24) == pack(">f", 24))
|
||||
end
|
||||
|
||||
print "testing pack/unpack of floating-point numbers"
|
||||
print "testing pack/unpack of floating-point numbers"
|
||||
|
||||
for _, n in ipairs{0, -1.1, 1.9, 1/0, -1/0, 1e20, -1e20, 0.1, 2000.7} do
|
||||
assert(unpack("n", pack("n", n)) == n)
|
||||
|
@ -243,7 +243,7 @@ do
|
|||
assert(#x == packsize("<b h b f d f n i"))
|
||||
local a, b, c, d, e, f, g, h = unpack("<b h b f d f n i", x)
|
||||
assert(a == 1 and b == 2 and c == 3 and d == 4 and e == 5 and f == 6 and
|
||||
g == 7 and h == 8)
|
||||
g == 7 and h == 8)
|
||||
end
|
||||
|
||||
print "testing alignment"
|
||||
|
@ -253,7 +253,7 @@ do
|
|||
assert(#x == packsize(">!8 b Xh i4 i8 c1 Xi8"))
|
||||
assert(x == "\xf4" .. "\0\0\0" ..
|
||||
"\0\0\0\100" ..
|
||||
"\0\0\0\0\0\0\0\xC8" ..
|
||||
"\0\0\0\0\0\0\0\xC8" ..
|
||||
"\xEC" .. "\0\0\0\0\0\0\0")
|
||||
local a, b, c, d, pos = unpack(">!8 c1 Xh i4 i8 b Xi8 XI XH", x)
|
||||
assert(a == "\xF4" and b == 100 and c == 200 and d == -20 and (pos - 1) == #x)
|
||||
|
@ -315,7 +315,7 @@ do -- testing initial position
|
|||
assert(unpack("c0", x, i) == "")
|
||||
end
|
||||
checkerror("out of string", unpack, "c0", x, #x + 2)
|
||||
|
||||
|
||||
end
|
||||
|
||||
print "OK"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue