mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 23:04:08 +10:00
Fixed some indexing bugs
This commit is contained in:
@@ -1,8 +1,22 @@
|
||||
|
||||
//test basic indexing
|
||||
{
|
||||
var week = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"];
|
||||
|
||||
assert week[1] == "tuesday", "basic indexing failed (single element)";
|
||||
|
||||
assert week[1:1] == ["tuesday"], "basic indexing failed (single element as array)";
|
||||
|
||||
assert week[:] == ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"], "basic default indexing failed (first and second)";
|
||||
assert week[::] == ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"], "basic default indexing failed (first, second and third)";
|
||||
}
|
||||
|
||||
|
||||
//test basic replacement
|
||||
{
|
||||
var week = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"];
|
||||
|
||||
week[3] = "Holiday";
|
||||
week[3:3] = "Holiday";
|
||||
|
||||
assert week == ["monday", "tuesday", "wednesday", "Holiday", "friday", "saturday", "sunday"], "basic replacement failed";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user