mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
Fixed nested assignment bug
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
|
||||
|
||||
//test nested indexing
|
||||
{
|
||||
var a = [[[0]]];
|
||||
|
||||
fn loop(count) {
|
||||
print count++;
|
||||
|
||||
loop(count);
|
||||
a[0][0][0] = 42;
|
||||
print a;
|
||||
assert a[0][0] == [42], "nested indexing failed";
|
||||
}
|
||||
|
||||
loop(0);
|
||||
@@ -61,4 +61,15 @@
|
||||
assert week[first:second:third] == ["wednesday", "tuesday"], "indexing with variables failed";
|
||||
}
|
||||
|
||||
|
||||
//test nested indexing
|
||||
{
|
||||
var a = [[[0]]];
|
||||
|
||||
a[0][0][0] = 42;
|
||||
|
||||
assert a[0][0] == [42], "nested indexing failed";
|
||||
}
|
||||
|
||||
|
||||
print "All good";
|
||||
|
||||
@@ -27,4 +27,17 @@
|
||||
assert d[first] == 2, "indexing with variables failed";
|
||||
}
|
||||
|
||||
|
||||
//test nested indexing
|
||||
{
|
||||
var d = ["foo": ["bar": 0]];
|
||||
|
||||
d["foo"]["bar"] = 42;
|
||||
|
||||
print d;
|
||||
|
||||
assert d == ["foo": ["bar": 42]], "nested indexing failed";
|
||||
}
|
||||
|
||||
|
||||
print "All good";
|
||||
|
||||
Reference in New Issue
Block a user