diff options
Diffstat (limited to 'testes/attrib.lua')
-rw-r--r-- | testes/attrib.lua | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/testes/attrib.lua b/testes/attrib.lua index d8b6e0f3..f4156086 100644 --- a/testes/attrib.lua +++ b/testes/attrib.lua | |||
@@ -308,11 +308,11 @@ else | |||
308 | _ENV.x, _ENV.y = nil | 308 | _ENV.x, _ENV.y = nil |
309 | end | 309 | end |
310 | 310 | ||
311 | |||
311 | _ENV = _G | 312 | _ENV = _G |
312 | 313 | ||
313 | 314 | ||
314 | -- testing preload | 315 | -- testing preload |
315 | |||
316 | do | 316 | do |
317 | local p = package | 317 | local p = package |
318 | package = {} | 318 | package = {} |
@@ -331,6 +331,26 @@ do | |||
331 | assert(type(package.path) == "string") | 331 | assert(type(package.path) == "string") |
332 | end | 332 | end |
333 | 333 | ||
334 | |||
335 | do print("testing external strings") | ||
336 | package.cpath = DC"?" | ||
337 | local lib2 = require"lib2-v2" | ||
338 | local t = {} | ||
339 | for _, len in ipairs{0, 10, 39, 40, 41, 1000} do | ||
340 | local str = string.rep("a", len) | ||
341 | local str1 = lib2.newstr(str) | ||
342 | assert(str == str1) | ||
343 | assert(not T or T.hash(str) == T.hash(str1)) | ||
344 | t[str1] = 20; assert(t[str] == 20 and t[str1] == 20) | ||
345 | t[str] = 10; assert(t[str1] == 10) | ||
346 | local tt = {[str1] = str1} | ||
347 | assert(next(tt) == str1 and next(tt, str1) == nil) | ||
348 | assert(tt[str] == str) | ||
349 | local str2 = lib2.newstr(str1) | ||
350 | assert(str == str2 and t[str2] == 10 and tt[str2] == str) | ||
351 | end | ||
352 | end | ||
353 | |||
334 | print('+') | 354 | print('+') |
335 | 355 | ||
336 | end --] | 356 | end --] |
@@ -447,7 +467,7 @@ do | |||
447 | end | 467 | end |
448 | 468 | ||
449 | 469 | ||
450 | -- test of large float/integer indices | 470 | -- test of large float/integer indices |
451 | 471 | ||
452 | -- compute maximum integer where all bits fit in a float | 472 | -- compute maximum integer where all bits fit in a float |
453 | local maxint = math.maxinteger | 473 | local maxint = math.maxinteger |