diff options
Diffstat (limited to 'testes/attrib.lua')
-rw-r--r-- | testes/attrib.lua | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/testes/attrib.lua b/testes/attrib.lua index 8a3462ea..f4156086 100644 --- a/testes/attrib.lua +++ b/testes/attrib.lua | |||
@@ -300,12 +300,6 @@ else | |||
300 | assert(_ENV.x == "lib2-v2" and _ENV.y == DC"lib2-v2") | 300 | assert(_ENV.x == "lib2-v2" and _ENV.y == DC"lib2-v2") |
301 | assert(lib2.id("x") == true) -- a different "id" implementation | 301 | assert(lib2.id("x") == true) -- a different "id" implementation |
302 | 302 | ||
303 | for _, len in ipairs{0, 10, 39, 40, 41, 1000} do | ||
304 | local str = string.rep("a", len) | ||
305 | local str1 = lib2.newstr(str) | ||
306 | assert(str == str1) | ||
307 | end | ||
308 | |||
309 | -- test C submodules | 303 | -- test C submodules |
310 | local fs, ext = require"lib1.sub" | 304 | local fs, ext = require"lib1.sub" |
311 | assert(_ENV.x == "lib1.sub" and _ENV.y == DC"lib1") | 305 | assert(_ENV.x == "lib1.sub" and _ENV.y == DC"lib1") |
@@ -314,11 +308,11 @@ else | |||
314 | _ENV.x, _ENV.y = nil | 308 | _ENV.x, _ENV.y = nil |
315 | end | 309 | end |
316 | 310 | ||
311 | |||
317 | _ENV = _G | 312 | _ENV = _G |
318 | 313 | ||
319 | 314 | ||
320 | -- testing preload | 315 | -- testing preload |
321 | |||
322 | do | 316 | do |
323 | local p = package | 317 | local p = package |
324 | package = {} | 318 | package = {} |
@@ -337,6 +331,26 @@ do | |||
337 | assert(type(package.path) == "string") | 331 | assert(type(package.path) == "string") |
338 | end | 332 | end |
339 | 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 | |||
340 | print('+') | 354 | print('+') |
341 | 355 | ||
342 | end --] | 356 | end --] |