(t *testing.T)
| 352 | } |
| 353 | |
| 354 | func TestPairsSplit(t *testing.T) { |
| 355 | testString(t, ` |
| 356 | local t = {} |
| 357 | -- first two keys go into array |
| 358 | t[1] = true |
| 359 | t[2] = true |
| 360 | -- next key forced into map instead of array since it's non-sequential |
| 361 | t[16] = true |
| 362 | -- next key inserted into array |
| 363 | t[3] = true |
| 364 | |
| 365 | local keys = {} |
| 366 | for k, v in pairs(t) do |
| 367 | keys[#keys + 1] = k |
| 368 | end |
| 369 | |
| 370 | table.sort(keys) |
| 371 | assert(keys[1] == 1, 'got ' .. tostring(keys[1]) .. '; want 1') |
| 372 | assert(keys[2] == 2, 'got ' .. tostring(keys[2]) .. '; want 2') |
| 373 | assert(keys[3] == 3, 'got ' .. tostring(keys[3]) .. '; want 3') |
| 374 | assert(keys[4] == 16, 'got ' .. tostring(keys[4]) .. '; want 16') |
| 375 | `) |
| 376 | } |
| 377 | |
| 378 | func TestConcurrentNext(t *testing.T) { |
| 379 | testString(t, ` |
nothing calls this directly
no test coverage detected