| 52 | } |
| 53 | |
| 54 | func TestTableAppend(t *testing.T) { |
| 55 | tbl := newLTable(0, 0) |
| 56 | tbl.RawSetInt(1, LNumber(1)) |
| 57 | tbl.RawSetInt(2, LNumber(2)) |
| 58 | tbl.RawSetInt(3, LNumber(3)) |
| 59 | errorIfNotEqual(t, 3, tbl.Len()) |
| 60 | |
| 61 | tbl.RawSetInt(1, LNil) |
| 62 | tbl.RawSetInt(2, LNil) |
| 63 | errorIfNotEqual(t, 3, tbl.Len()) |
| 64 | |
| 65 | tbl.Append(LNumber(4)) |
| 66 | errorIfNotEqual(t, 4, tbl.Len()) |
| 67 | |
| 68 | tbl.RawSetInt(3, LNil) |
| 69 | tbl.RawSetInt(4, LNil) |
| 70 | errorIfNotEqual(t, 0, tbl.Len()) |
| 71 | |
| 72 | tbl.Append(LNumber(5)) |
| 73 | errorIfNotEqual(t, 1, tbl.Len()) |
| 74 | } |
| 75 | |
| 76 | func TestTableInsert(t *testing.T) { |
| 77 | tbl := newLTable(0, 0) |