(t *testing.T)
| 276 | } |
| 277 | |
| 278 | func TestTableNext(t *testing.T) { |
| 279 | l := NewState() |
| 280 | OpenLibraries(l) |
| 281 | l.CreateTable(10, 0) |
| 282 | for i := 1; i <= 4; i++ { |
| 283 | l.PushInteger(i) |
| 284 | l.PushValue(-1) |
| 285 | l.SetTable(-3) |
| 286 | } |
| 287 | if length := LengthEx(l, -1); length != 4 { |
| 288 | t.Errorf("expected table length to be 4, but was %d", length) |
| 289 | } |
| 290 | count := 0 |
| 291 | for l.PushNil(); l.Next(-2); count++ { |
| 292 | if k, v := CheckInteger(l, -2), CheckInteger(l, -1); k != v { |
| 293 | t.Errorf("key %d != value %d", k, v) |
| 294 | } |
| 295 | l.Pop(1) |
| 296 | } |
| 297 | if count != 4 { |
| 298 | t.Errorf("incorrect iteration count %d in Next()", count) |
| 299 | } |
| 300 | } |
| 301 | |
| 302 | func TestError(t *testing.T) { |
| 303 | l := NewState() |
nothing calls this directly
no test coverage detected