1
0
forked from Mirror/wren
Files
wren/test/core/list/filled.wren
Bob Nystrom 3666eae013 Tweak new list constructors.
- Remove List.new(_). I was convinced by the issue discussion that
  using it is probably a bad idea. We don't want to encourage more nulls
  in the world than there are already are. So let's see if we can live
  without it and just have List.filled(). That way users think about
  what they're creating a list *of*.
- Added some more tests.
- Correctly handle being given a negative size.
2016-08-03 22:42:31 -07:00

9 lines
257 B
Plaintext

var list = List.filled(3, "value")
System.print(list.count) // expect: 3
System.print(list) // expect: [value, value, value]
// Can create an empty list.
list = List.filled(0, "value")
System.print(list.count) // expect: 0
System.print(list) // expect: []