Files
wren/test/core/sequence/is_empty.wren
T

12 lines
325 B
Plaintext
Raw Normal View History

2015-09-15 07:46:09 -07:00
System.print([].isEmpty) // expect: true
System.print([1].isEmpty) // expect: false
2015-06-30 06:52:29 -07:00
class InfiniteSequence is Sequence {
2015-09-01 08:16:04 -07:00
construct new() {}
2015-06-30 06:52:29 -07:00
iterate(iterator) { true }
iteratorValue(iterator) { iterator }
}
// Should not try to iterate the whole sequence.
2015-09-15 07:46:09 -07:00
System.print(InfiniteSequence.new().isEmpty) // expect: false