Files
Toy/scripts/test/index-dictionaries.toy
2022-09-06 10:49:22 +01:00

42 lines
564 B
Plaintext

//test basic insertion
{
var d = [:];
d["foo"] = "bar";
assert d == ["foo":"bar"], "basic insertion failed";
}
//test dot insertion
{
var d = [:];
d.foo = "bar";
assert d == ["foo":"bar"], "dot insertion failed";
}
//test index arithmetic
{
var d = ["one":1, "two":2, "three":3];
d["three"] *= 3;
assert d == ["one":1, "two":2, "three":9], "index arithmetic failed";
}
//test dot arithmetic
{
var d = ["one":1, "two":2, "three":3];
d.three *= 3;
assert d == ["one":1, "two":2, "three":9], "index arithmetic failed";
}
print "All good";