Commit Graph

1133 Commits

Author SHA1 Message Date
Enrico Horn
9a65948e26 Rework and complete OsLib's date formatting 2021-07-22 22:46:58 +02:00
Enrico Horn
66130964c6 Convert mathlib.modf result to number 2021-07-22 22:29:09 +02:00
Enrico Horn
abe14ca995 Disable debuglib tests for now
Too many failing tests that need to be fixed first
2021-07-22 22:29:09 +02:00
Enrico Horn
30a3a472bc Luajit crashes when closing a closed file 2021-07-22 22:29:08 +02:00
Enrico Horn
e87d9ceee4 Disabled a few more tests for now 2021-07-22 22:29:07 +02:00
Enrico Horn
3e9ae5c524 Luajit doesnt implement table.unpack in the current stable version 2021-07-22 22:29:03 +02:00
Enrico Horn
ddba10c180 Bring debuglib.getlocal Implementation closer to native 2021-07-22 22:29:02 +02:00
Enrico Horn
39e9be0a2d Deactivate a debuglib.getlocal error test for now 2021-07-22 22:29:02 +02:00
Enrico Horn
b1322640ca Always initialize a CallFrame's stack 2021-07-22 22:29:01 +02:00
Enrico Horn
99bd46876e Report errors about closures as function expected 2021-07-22 22:29:01 +02:00
Enrico Horn
23ae7cdc06 Fix order of argument checks in debug.upvaluejoin 2021-07-22 22:29:00 +02:00
Enrico Horn
942dc4afa3 More debug.upvaluejoin error tests 2021-07-22 22:29:00 +02:00
Enrico Horn
11ec746838 Fix order of argument checks in debug.upvalueid 2021-07-22 22:28:59 +02:00
Enrico Horn
b8b951b7c9 Fix order of argument checks in debug.setupvalue 2021-07-22 22:28:59 +02:00
Enrico Horn
1f9a874979 More setupvalue error tests 2021-07-22 22:28:58 +02:00
Enrico Horn
b121b65151 Handle rhs of zero for operation fmod 2021-07-22 00:06:12 +02:00
Enrico Horn
5851e6994a Lua also returns a negative NaN string 2021-07-22 00:06:12 +02:00
Enrico Horn
5984ec6097 Remove test files created during iolib tests 2021-07-22 00:06:12 +02:00
Enrico Horn
4802623aa3 Only check return type in xpcall pass tests
The error message is more specific with luaj
2021-07-22 00:06:11 +02:00
Enrico Horn
2fdcf5e2ac Disable string.dump pass checks for now 2021-07-22 00:06:11 +02:00
Enrico Horn
560a4694e4 Fix string.gsub behaviour with negative n 2021-07-22 00:06:11 +02:00
Enrico Horn
6b9dece367 Fix mathlib min, max and atan2 behaviour 2021-07-22 00:06:11 +02:00
Enrico Horn
179062493d Implement package.seeall 2021-07-22 00:06:11 +02:00
Enrico Horn
f81bc1e174 Make some errors compatible with native lua 2021-07-22 00:06:11 +02:00
Enrico Horn
bf23883492 Define clean up steps and clean up code 2021-07-22 00:06:11 +02:00
Enrico Horn
5465eff841 Update test result files in a platform dependant manner from native lua 2021-07-22 00:06:11 +02:00
Enrico Horn
ddc7531845 Remove invalid lua5.2 OOB calls from tablelib.lua 2021-07-22 00:06:11 +02:00
Enrico Horn
58a4dec882 Update errors tests for lua 5.2 2021-07-22 00:06:11 +02:00
Enrico Horn
f91cc9a509 Scripts to create result files from native lua 2021-07-22 00:06:11 +02:00
Enrico Horn
9792fcb018 Cleanup Tests with JUnit5 and move to different modules 2021-07-11 23:13:57 +02:00
Enrico Horn
1a6de4a227 Remove temprory test files and ignore them 2021-07-11 23:00:02 +02:00
Enrico Horn
1833c57d4d Extract luaj3.0-tests.zip to luaj-test/src/test/resources and delete it 2021-07-11 22:59:08 +02:00
Enrico Horn
e7e6190f9c Add formatter definition and format code 2021-07-03 22:23:49 +02:00
Enrico Horn
3c266bcc98 Move Lua5x.jj to lua-jse and customize package name 2021-07-03 22:19:30 +02:00
Enrico Horn
d2a92c07d3 Convert all line endings to Unix 2021-07-03 22:15:19 +02:00
Enrico Horn
a58147ddfa Move sources into maven modules 2021-03-11 22:07:08 +01:00
Enrico Horn
74e5ef6f36 Ignore eclipse project files 2021-03-07 01:39:37 +01:00
Enrico Horn
a9d475bbbf Remove eclipse project files 2021-03-05 21:26:41 +01:00
Enyby
daf3da94e3 Fix #66: Broken license link. 2020-04-01 19:36:00 +03:00
Enyby
30e60a883e Create LICENSE
Source: https://web.archive.org/web/20140514153921/http://sourceforge.net/dbimage.php?id=196142
2020-04-01 19:31:39 +03:00
Enyby
27edcc9a92 Fix possible error in rare cases in LuaTable:
java.lang.ArrayIndexOutOfBoundsException: length=0; index=0
2019-12-29 16:46:58 +02:00
Enyby
d6737c0bb3 Improve work with weak keys.
```
for _, m in ipairs({'', 'k', 'kv', 'v'}) do
	print('test', m)
	a = {}; setmetatable(a, {__mode = m});
	a[1], a[2], a[3] = {}, {}, {};
	for k, v in pairs(a) do
		print(k, v)
	end
end
print('ok')
```
2019-12-16 15:31:13 +02:00
Enyby
d201bc3012 Fix work with weak tables.
```
a = {}; setmetatable(a, {__mode = 'vk'});
a[1], a[2], a[3] = {}, {}, {};
for k, v in pairs(a) do
	print(k, v)
end
print('ok')
```
2019-12-15 20:39:26 +02:00
Enyby
ca64666242 Fix metamethods for compare with numbers.
```
t = {}
t.__lt = function (a,b,c)
  collectgarbage()
  assert(c == nil)
  if type(a) == 'table' then a = a.x end
  if type(b) == 'table' then b = b.x end
 return a<b, "dummy"
end

function Op(x) return setmetatable({x=x}, t) end

local function test ()
  assert(not(Op(1)<Op(1)) and (Op(1)<Op(2)) and not(Op(2)<Op(1)))
  assert(not(1 < Op(1)) and (Op(1) < 2) and not(2 < Op(1)))
  assert(not(Op('a')<Op('a')) and (Op('a')<Op('b')) and not(Op('b')<Op('a')))
  assert(not('a' < Op('a')) and (Op('a') < 'b') and not(Op('b') < Op('a')))
  assert((Op(1)<=Op(1)) and (Op(1)<=Op(2)) and not(Op(2)<=Op(1)))
  assert((Op('a')<=Op('a')) and (Op('a')<=Op('b')) and not(Op('b')<=Op('a')))
  assert(not(Op(1)>Op(1)) and not(Op(1)>Op(2)) and (Op(2)>Op(1)))
  assert(not(Op('a')>Op('a')) and not(Op('a')>Op('b')) and (Op('b')>Op('a')))
  assert((Op(1)>=Op(1)) and not(Op(1)>=Op(2)) and (Op(2)>=Op(1)))
  assert((1 >= Op(1)) and not(1 >= Op(2)) and (Op(2) >= 1))
  assert((Op('a')>=Op('a')) and not(Op('a')>=Op('b')) and (Op('b')>=Op('a')))
  assert(('a' >= Op('a')) and not(Op('a') >= 'b') and (Op('b') >= Op('a')))
end

test()
```
2019-11-11 02:47:19 +02:00
Enyby
725cf89b6f Fix metamethods for compare with string. 2019-11-11 02:29:20 +02:00
Enyby
da0b06555a Fix pattern error message. 2019-11-09 23:26:48 +02:00
Enyby
ee2d5284e7 Fix '%b' pattern error message. 2019-11-09 23:25:58 +02:00
Enyby
0f0ec4bf7b Add check for too complex patterns.
```
-- bug since 2.5 (C-stack overflow)
do
  local function f (size)
    local s = string.rep("a", size)
    local p = string.rep(".?", size)
    return pcall(string.match, s, p)
  end
  local r, m = f(80)
  assert(r and #m == 80)
  r, m = f(200000)
  assert(not r and string.find(m, "too complex"), tostring(r)..", "..tostring(m))
end
```
2019-11-09 23:25:07 +02:00
Enyby
5813d56f89 Improve error messages for invalid capture index. 2019-11-09 23:21:39 +02:00
Enyby
8c42c4712b Fix empty matches in patterns.
```
do   -- new (5.3.3) semantics for empty matches
  assert(string.gsub("a b cd", " *", "-") == "-a-b-c-d-")

  local res = ""
  local sub = "a  \nbc\t\td"
  local i = 1
  for p, e in string.gmatch(sub, "()%s*()") do
    res = res .. string.sub(sub, i, p - 1) .. "-"
    i = e
  end
  assert(res == "-a-b-c-d-")
end
```
2019-11-09 23:20:06 +02:00