Allow [0..-1] and [0...0] to work on empty lists.

This commit is contained in:
Bob Nystrom
2014-02-14 20:10:41 -08:00
parent ca7ff222fe
commit ea3cfa05bd
3 changed files with 18 additions and 8 deletions

View File

@ -29,3 +29,7 @@ IO.print(list[1..-2]) // expect: [b, c, d]
IO.print(list[2...-1]) // expect: [c, d]
IO.print(list[4..-5]) // expect: [e, d, c, b, a]
IO.print(list[3...-6]) // expect: [d, c, b, a]
// An empty range at zero is allowed on an empty list.
IO.print([][0...0]) // expect: []
IO.print([][0..-1]) // expect: []