feat: replace IO class with System class and remove separate IO module
- Delete wren_io.c, wren_io.h, and io.wren source files - Remove multi-arity print overloads and IO.read/IO.time methods - Add System class with print, printAll, write, writeAll methods to core.wren - Update all documentation examples and README to use System.print instead of IO.print
This commit is contained in:
@@ -8,9 +8,6 @@ This contains the automated validation suite for the VM and built-in libraries.
|
||||
classes. If a bug is in `wren_core.c` or `wren_value.c`, it will most likely
|
||||
break one of these tests.
|
||||
|
||||
* `io/` - Tests for the built in IO library. In other words, methods on the
|
||||
`IO` class. If a bug is in `wren_io.c`, it should break one of these tests.
|
||||
|
||||
* `language/` - Tests of the language itself, its grammar and runtime
|
||||
semantics. If a bug is in `wren_compiler.c` or `wren_vm.c`, it will most
|
||||
likely break one of these tests. This includes tests for the syntax for the
|
||||
|
||||
+13
-13
@@ -11,27 +11,27 @@ foreign class Counter {
|
||||
}
|
||||
|
||||
var counter = Counter.new()
|
||||
IO.print(counter.value) // expect: 0
|
||||
System.print(counter.value) // expect: 0
|
||||
counter.increment(3.1)
|
||||
IO.print(counter.value) // expect: 3.1
|
||||
System.print(counter.value) // expect: 3.1
|
||||
counter.increment(1.2)
|
||||
IO.print(counter.value) // expect: 4.3
|
||||
System.print(counter.value) // expect: 4.3
|
||||
|
||||
// Foreign classes can inherit a class as long as it has no fields.
|
||||
class PointBase {
|
||||
inherited() {
|
||||
IO.print("inherited method")
|
||||
System.print("inherited method")
|
||||
}
|
||||
}
|
||||
|
||||
// Class with non-default constructor.
|
||||
foreign class Point is PointBase {
|
||||
construct new() {
|
||||
IO.print("default")
|
||||
System.print("default")
|
||||
}
|
||||
|
||||
construct new(x, y, z) {
|
||||
IO.print(x, ", ", y, ", ", z)
|
||||
System.print(x.toString + ", " + y.toString + ", " + z.toString)
|
||||
}
|
||||
|
||||
foreign translate(x, y, z)
|
||||
@@ -39,19 +39,19 @@ foreign class Point is PointBase {
|
||||
}
|
||||
|
||||
var p = Point.new(1, 2, 3) // expect: 1, 2, 3
|
||||
IO.print(p) // expect: (1, 2, 3)
|
||||
System.print(p) // expect: (1, 2, 3)
|
||||
p.translate(3, 4, 5)
|
||||
IO.print(p) // expect: (4, 6, 8)
|
||||
System.print(p) // expect: (4, 6, 8)
|
||||
|
||||
p = Point.new() // expect: default
|
||||
IO.print(p) // expect: (0, 0, 0)
|
||||
System.print(p) // expect: (0, 0, 0)
|
||||
|
||||
p.inherited() // expect: inherited method
|
||||
|
||||
var error = Fiber.new {
|
||||
class Subclass is Point {}
|
||||
}.try()
|
||||
IO.print(error) // expect: Class 'Subclass' cannot inherit from foreign class 'Point'.
|
||||
System.print(error) // expect: Class 'Subclass' cannot inherit from foreign class 'Point'.
|
||||
|
||||
// Class with a finalizer.
|
||||
foreign class Resource {
|
||||
@@ -65,14 +65,14 @@ var resources = [
|
||||
]
|
||||
|
||||
Api.gc()
|
||||
IO.print(Api.finalized) // expect: 0
|
||||
System.print(Api.finalized) // expect: 0
|
||||
|
||||
resources.removeAt(-1)
|
||||
|
||||
Api.gc()
|
||||
IO.print(Api.finalized) // expect: 1
|
||||
System.print(Api.finalized) // expect: 1
|
||||
|
||||
resources.clear()
|
||||
|
||||
Api.gc()
|
||||
IO.print(Api.finalized) // expect: 3
|
||||
System.print(Api.finalized) // expect: 3
|
||||
|
||||
@@ -8,10 +8,10 @@ class Api {
|
||||
foreign static returnFalse
|
||||
}
|
||||
|
||||
IO.print(Api.implicitNull == null) // expect: true
|
||||
System.print(Api.implicitNull == null) // expect: true
|
||||
|
||||
IO.print(Api.returnInt) // expect: 123456
|
||||
IO.print(Api.returnFloat) // expect: 123.456
|
||||
System.print(Api.returnInt) // expect: 123456
|
||||
System.print(Api.returnFloat) // expect: 123.456
|
||||
|
||||
IO.print(Api.returnTrue) // expect: true
|
||||
IO.print(Api.returnFalse) // expect: false
|
||||
System.print(Api.returnTrue) // expect: true
|
||||
System.print(Api.returnFalse) // expect: false
|
||||
|
||||
+1
-1
@@ -11,4 +11,4 @@ for (i in 1...10) {
|
||||
s = s + " more"
|
||||
}
|
||||
|
||||
IO.print(Api.value) // expect: [list, of, strings]
|
||||
System.print(Api.value) // expect: [list, of, strings]
|
||||
|
||||
@@ -24,10 +24,10 @@ var minDepth = 4
|
||||
var maxDepth = 12
|
||||
var stretchDepth = maxDepth + 1
|
||||
|
||||
var start = IO.clock
|
||||
var start = System.clock
|
||||
|
||||
IO.print("stretch tree of depth ", stretchDepth, " check: ",
|
||||
Tree.new(0, stretchDepth).check)
|
||||
System.print("stretch tree of depth " + stretchDepth.toString + " check: " +
|
||||
Tree.new(0, stretchDepth).check.toString)
|
||||
|
||||
var longLivedTree = Tree.new(0, maxDepth)
|
||||
|
||||
@@ -44,10 +44,12 @@ while (depth < stretchDepth) {
|
||||
check = check + Tree.new(i, depth).check + Tree.new(-i, depth).check
|
||||
}
|
||||
|
||||
IO.print((iterations * 2), " trees of depth ", depth, " check: ", check)
|
||||
System.print((iterations * 2).toString + " trees of depth " +
|
||||
depth.toString + " check: " + check.toString)
|
||||
iterations = iterations / 4
|
||||
depth = depth + 2
|
||||
}
|
||||
|
||||
IO.print("long lived tree of depth ", maxDepth, " check: ", longLivedTree.check)
|
||||
IO.print("elapsed: ", (IO.clock - start))
|
||||
System.print("long lived tree of depth " + maxDepth.toString + " check: " +
|
||||
longLivedTree.check.toString)
|
||||
System.print("elapsed: " + (System.clock - start).toString)
|
||||
|
||||
@@ -92,7 +92,7 @@ class Constraint {
|
||||
chooseMethod(mark)
|
||||
if (!isSatisfied) {
|
||||
if (_strength == REQUIRED) {
|
||||
IO.print("Could not satisfy a required constraint!")
|
||||
System.print("Could not satisfy a required constraint!")
|
||||
}
|
||||
return null
|
||||
}
|
||||
@@ -102,7 +102,7 @@ class Constraint {
|
||||
var overridden = out.determinedBy
|
||||
if (overridden != null) overridden.markUnsatisfied
|
||||
out.determinedBy = this
|
||||
if (!ThePlanner.addPropagate(this, mark)) IO.print("Cycle encountered")
|
||||
if (!ThePlanner.addPropagate(this, mark)) System.print("Cycle encountered")
|
||||
out.mark = mark
|
||||
return overridden
|
||||
}
|
||||
@@ -669,31 +669,31 @@ var projectionTest = Fn.new {|n|
|
||||
|
||||
change.call(src, 17)
|
||||
total = total + dst.value
|
||||
if (dst.value != 1170) IO.print("Projection 1 failed")
|
||||
if (dst.value != 1170) System.print("Projection 1 failed")
|
||||
|
||||
change.call(dst, 1050)
|
||||
|
||||
total = total + src.value
|
||||
if (src.value != 5) IO.print("Projection 2 failed")
|
||||
if (src.value != 5) System.print("Projection 2 failed")
|
||||
|
||||
change.call(scale, 5)
|
||||
for (i in 0...n - 1) {
|
||||
total = total + dests[i].value
|
||||
if (dests[i].value != i * 5 + 1000) IO.print("Projection 3 failed")
|
||||
if (dests[i].value != i * 5 + 1000) System.print("Projection 3 failed")
|
||||
}
|
||||
|
||||
change.call(offset, 2000)
|
||||
for (i in 0...n - 1) {
|
||||
total = total + dests[i].value
|
||||
if (dests[i].value != i * 5 + 2000) IO.print("Projection 4 failed")
|
||||
if (dests[i].value != i * 5 + 2000) System.print("Projection 4 failed")
|
||||
}
|
||||
}
|
||||
|
||||
var start = IO.clock
|
||||
var start = System.clock
|
||||
for (i in 0...40) {
|
||||
chainTest.call(100)
|
||||
projectionTest.call(100)
|
||||
}
|
||||
|
||||
IO.print(total)
|
||||
IO.print("elapsed: ", IO.clock - start)
|
||||
System.print(total)
|
||||
System.print("elapsed: " + (System.clock - start).toString)
|
||||
|
||||
@@ -5,8 +5,8 @@ class Fib {
|
||||
}
|
||||
}
|
||||
|
||||
var start = IO.clock
|
||||
var start = System.clock
|
||||
for (i in 1..5) {
|
||||
IO.print(Fib.get(28))
|
||||
System.print(Fib.get(28))
|
||||
}
|
||||
IO.print("elapsed: ", IO.clock - start)
|
||||
System.print("elapsed: " + (System.clock - start).toString)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
var fibers = []
|
||||
var sum = 0
|
||||
|
||||
var start = IO.clock
|
||||
var start = System.clock
|
||||
|
||||
for (i in 0...100000) {
|
||||
fibers.add(Fiber.new {
|
||||
@@ -12,5 +12,5 @@ for (i in 0...100000) {
|
||||
}
|
||||
|
||||
fibers[0].call()
|
||||
IO.print(sum)
|
||||
IO.print("elapsed: ", IO.clock - start)
|
||||
System.print(sum)
|
||||
System.print("elapsed: " + (System.clock - start).toString)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
var list = []
|
||||
|
||||
var start = IO.clock
|
||||
var start = System.clock
|
||||
for (i in 0...1000000) list.add(i)
|
||||
|
||||
var sum = 0
|
||||
for (i in list) sum = sum + i
|
||||
|
||||
IO.print(sum)
|
||||
IO.print("elapsed: ", IO.clock - start)
|
||||
System.print(sum)
|
||||
System.print("elapsed: " + (System.clock - start).toString)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
var start = IO.clock
|
||||
var start = System.clock
|
||||
|
||||
var map = {}
|
||||
|
||||
@@ -10,10 +10,10 @@ var sum = 0
|
||||
for (i in 1..1000000) {
|
||||
sum = sum + map[i]
|
||||
}
|
||||
IO.print(sum)
|
||||
System.print(sum)
|
||||
|
||||
for (i in 1..1000000) {
|
||||
map.remove(i)
|
||||
}
|
||||
|
||||
IO.print("elapsed: ", IO.clock - start)
|
||||
System.print("elapsed: " + (System.clock - start).toString)
|
||||
|
||||
@@ -77,7 +77,7 @@ for (animal in animals) {
|
||||
}
|
||||
}
|
||||
|
||||
var start = IO.clock
|
||||
var start = System.clock
|
||||
|
||||
var map = {}
|
||||
|
||||
@@ -96,5 +96,5 @@ for (key in keys) {
|
||||
map.remove(key)
|
||||
}
|
||||
|
||||
IO.print(sum)
|
||||
IO.print("elapsed: ", IO.clock - start)
|
||||
System.print(sum)
|
||||
System.print("elapsed: " + (System.clock - start).toString)
|
||||
|
||||
@@ -28,7 +28,7 @@ class NthToggle is Toggle {
|
||||
}
|
||||
}
|
||||
|
||||
var start = IO.clock
|
||||
var start = System.clock
|
||||
var n = 100000
|
||||
var val = true
|
||||
var toggle = Toggle.new(val)
|
||||
@@ -46,7 +46,7 @@ for (i in 0...n) {
|
||||
val = toggle.activate.value
|
||||
}
|
||||
|
||||
IO.print(toggle.value)
|
||||
System.print(toggle.value)
|
||||
|
||||
val = true
|
||||
var ntoggle = NthToggle.new(val, 3)
|
||||
@@ -64,5 +64,5 @@ for (i in 0...n) {
|
||||
val = ntoggle.activate.value
|
||||
}
|
||||
|
||||
IO.print(ntoggle.value)
|
||||
IO.print("elapsed: ", IO.clock - start)
|
||||
System.print(ntoggle.value)
|
||||
System.print("elapsed: " + (System.clock - start).toString)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
var start = IO.clock
|
||||
var start = System.clock
|
||||
|
||||
var count = 0
|
||||
for (i in 1..1000000) {
|
||||
@@ -20,5 +20,5 @@ for (i in 1..1000000) {
|
||||
"another") count = count + 1
|
||||
}
|
||||
|
||||
IO.print(count)
|
||||
IO.print("elapsed: ", IO.clock - start)
|
||||
System.print(count)
|
||||
System.print("elapsed: " + (System.clock - start).toString)
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
IO.print(true == true) // expect: true
|
||||
IO.print(true == false) // expect: false
|
||||
IO.print(false == true) // expect: false
|
||||
IO.print(false == false) // expect: true
|
||||
System.print(true == true) // expect: true
|
||||
System.print(true == false) // expect: false
|
||||
System.print(false == true) // expect: false
|
||||
System.print(false == false) // expect: true
|
||||
|
||||
// Not equal to other types.
|
||||
IO.print(true == 1) // expect: false
|
||||
IO.print(false == 0) // expect: false
|
||||
IO.print(true == "true") // expect: false
|
||||
IO.print(false == "false") // expect: false
|
||||
IO.print(false == "") // expect: false
|
||||
System.print(true == 1) // expect: false
|
||||
System.print(false == 0) // expect: false
|
||||
System.print(true == "true") // expect: false
|
||||
System.print(false == "false") // expect: false
|
||||
System.print(false == "") // expect: false
|
||||
|
||||
IO.print(true != true) // expect: false
|
||||
IO.print(true != false) // expect: true
|
||||
IO.print(false != true) // expect: true
|
||||
IO.print(false != false) // expect: false
|
||||
System.print(true != true) // expect: false
|
||||
System.print(true != false) // expect: true
|
||||
System.print(false != true) // expect: true
|
||||
System.print(false != false) // expect: false
|
||||
|
||||
// Not equal to other types.
|
||||
IO.print(true != 1) // expect: true
|
||||
IO.print(false != 0) // expect: true
|
||||
IO.print(true != "true") // expect: true
|
||||
IO.print(false != "false") // expect: true
|
||||
IO.print(false != "") // expect: true
|
||||
System.print(true != 1) // expect: true
|
||||
System.print(false != 0) // expect: true
|
||||
System.print(true != "true") // expect: true
|
||||
System.print(false != "false") // expect: true
|
||||
System.print(false != "") // expect: true
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
IO.print(!true) // expect: false
|
||||
IO.print(!false) // expect: true
|
||||
IO.print(!!true) // expect: true
|
||||
System.print(!true) // expect: false
|
||||
System.print(!false) // expect: true
|
||||
System.print(!!true) // expect: true
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
IO.print(true.toString) // expect: true
|
||||
IO.print(false.toString) // expect: false
|
||||
System.print(true.toString) // expect: true
|
||||
System.print(false.toString) // expect: false
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
IO.print(true is Bool) // expect: true
|
||||
IO.print(true is Object) // expect: true
|
||||
IO.print(true is Num) // expect: false
|
||||
IO.print(true.type == Bool) // expect: true
|
||||
System.print(true is Bool) // expect: true
|
||||
System.print(true is Object) // expect: true
|
||||
System.print(true is Num) // expect: false
|
||||
System.print(true.type == Bool) // expect: true
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
IO.print(Num == Num) // expect: true
|
||||
IO.print(Num == Bool) // expect: false
|
||||
System.print(Num == Num) // expect: true
|
||||
System.print(Num == Bool) // expect: false
|
||||
|
||||
// Not equal to other types.
|
||||
IO.print(Num == 123) // expect: false
|
||||
IO.print(Num == true) // expect: false
|
||||
System.print(Num == 123) // expect: false
|
||||
System.print(Num == true) // expect: false
|
||||
|
||||
IO.print(Num != Num) // expect: false
|
||||
IO.print(Num != Bool) // expect: true
|
||||
System.print(Num != Num) // expect: false
|
||||
System.print(Num != Bool) // expect: true
|
||||
|
||||
// Not equal to other types.
|
||||
IO.print(Num != 123) // expect: true
|
||||
IO.print(Num != true) // expect: true
|
||||
System.print(Num != 123) // expect: true
|
||||
System.print(Num != true) // expect: true
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
class Foo {}
|
||||
|
||||
IO.print(Foo.name) // expect: Foo
|
||||
IO.print(Foo.type.name) // expect: Foo metaclass
|
||||
System.print(Foo.name) // expect: Foo
|
||||
System.print(Foo.type.name) // expect: Foo metaclass
|
||||
|
||||
// Make sure the built-in classes have proper names too.
|
||||
IO.print(Object.name) // expect: Object
|
||||
IO.print(Bool.name) // expect: Bool
|
||||
IO.print(Class.name) // expect: Class
|
||||
System.print(Object.name) // expect: Object
|
||||
System.print(Bool.name) // expect: Bool
|
||||
System.print(Class.name) // expect: Class
|
||||
|
||||
// And metaclass names.
|
||||
IO.print(Object.type.name) // expect: Object metaclass
|
||||
IO.print(Bool.type.name) // expect: Bool metaclass
|
||||
System.print(Object.type.name) // expect: Object metaclass
|
||||
System.print(Bool.type.name) // expect: Bool metaclass
|
||||
|
||||
@@ -5,11 +5,11 @@ class Bar is Foo {}
|
||||
class Baz is Bar {}
|
||||
|
||||
// A class with no explicit superclass inherits Object.
|
||||
IO.print(Foo.supertype == Object) // expect: true
|
||||
System.print(Foo.supertype == Object) // expect: true
|
||||
|
||||
// Otherwise, it's the superclass.
|
||||
IO.print(Bar.supertype == Foo) // expect: true
|
||||
IO.print(Baz.supertype == Bar) // expect: true
|
||||
System.print(Bar.supertype == Foo) // expect: true
|
||||
System.print(Baz.supertype == Bar) // expect: true
|
||||
|
||||
// Object has no supertype.
|
||||
IO.print(Object.supertype) // expect: null
|
||||
System.print(Object.supertype) // expect: null
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
class Foo {}
|
||||
|
||||
// A class is a class.
|
||||
IO.print(Foo is Class) // expect: true
|
||||
System.print(Foo is Class) // expect: true
|
||||
|
||||
// Its metatype is also a class.
|
||||
IO.print(Foo.type is Class) // expect: true
|
||||
System.print(Foo.type is Class) // expect: true
|
||||
|
||||
// The metatype's metatype is Class.
|
||||
IO.print(Foo.type.type == Class) // expect: true
|
||||
System.print(Foo.type.type == Class) // expect: true
|
||||
|
||||
// And Class's metatype circles back onto itself.
|
||||
IO.print(Foo.type.type.type == Class) // expect: true
|
||||
IO.print(Foo.type.type.type.type == Class) // expect: true
|
||||
IO.print(Foo.type.type.type.type.type == Class) // expect: true
|
||||
System.print(Foo.type.type.type == Class) // expect: true
|
||||
System.print(Foo.type.type.type.type == Class) // expect: true
|
||||
System.print(Foo.type.type.type.type.type == Class) // expect: true
|
||||
|
||||
@@ -2,6 +2,6 @@ var fiber = Fiber.new {
|
||||
Fiber.abort("Error message.")
|
||||
}
|
||||
|
||||
IO.print(fiber.try()) // expect: Error message.
|
||||
IO.print(fiber.isDone) // expect: true
|
||||
IO.print(fiber.error) // expect: Error message.
|
||||
System.print(fiber.try()) // expect: Error message.
|
||||
System.print(fiber.isDone) // expect: true
|
||||
System.print(fiber.error) // expect: Error message.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
var fiber = Fiber.new {
|
||||
IO.print("fiber")
|
||||
System.print("fiber")
|
||||
}
|
||||
|
||||
IO.print("before") // expect: before
|
||||
System.print("before") // expect: before
|
||||
fiber.call() // expect: fiber
|
||||
IO.print("after") // expect: after
|
||||
System.print("after") // expect: after
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
var fiber = Fiber.new {
|
||||
IO.print("call")
|
||||
System.print("call")
|
||||
}
|
||||
|
||||
fiber.call() // expect: call
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
var fiber = Fiber.new {
|
||||
Fiber.abort("Error!")
|
||||
IO.print("should not get here")
|
||||
System.print("should not get here")
|
||||
}
|
||||
|
||||
fiber.try()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
var fiber = Fiber.new {
|
||||
IO.print("fiber") // expect: fiber
|
||||
System.print("fiber") // expect: fiber
|
||||
}
|
||||
|
||||
IO.print(fiber.call()) // expect: null
|
||||
System.print(fiber.call()) // expect: null
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
var fiber = Fiber.new {
|
||||
IO.print("fiber")
|
||||
System.print("fiber")
|
||||
return "result" // expect: fiber
|
||||
}
|
||||
|
||||
IO.print(fiber.call()) // expect: result
|
||||
System.print(fiber.call()) // expect: result
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
var main = Fiber.current
|
||||
|
||||
var fiber = Fiber.new {
|
||||
IO.print("transferred")
|
||||
IO.print(main.transfer())
|
||||
IO.print("called")
|
||||
System.print("transferred")
|
||||
System.print(main.transfer())
|
||||
System.print("called")
|
||||
}
|
||||
|
||||
fiber.transfer() // expect: transferred
|
||||
IO.print("main") // expect: main
|
||||
System.print("main") // expect: main
|
||||
fiber.call() // expect: null
|
||||
// expect: called
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
var fiber = Fiber.new {
|
||||
IO.print("fiber")
|
||||
System.print("fiber")
|
||||
}
|
||||
|
||||
// The first value passed to the fiber is ignored, since there's no yield call
|
||||
// to return it.
|
||||
IO.print("before") // expect: before
|
||||
System.print("before") // expect: before
|
||||
fiber.call("ignored") // expect: fiber
|
||||
IO.print("after") // expect: after
|
||||
System.print("after") // expect: after
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
var fiber = Fiber.new {
|
||||
IO.print("call")
|
||||
System.print("call")
|
||||
}
|
||||
|
||||
fiber.call(1) // expect: call
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
var fiber = Fiber.new {
|
||||
Fiber.abort("Error!")
|
||||
IO.print("should not get here")
|
||||
System.print("should not get here")
|
||||
}
|
||||
|
||||
fiber.try()
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
var main = Fiber.current
|
||||
|
||||
var fiber = Fiber.new {
|
||||
IO.print("transferred")
|
||||
IO.print(main.transfer())
|
||||
IO.print("called")
|
||||
System.print("transferred")
|
||||
System.print(main.transfer())
|
||||
System.print("called")
|
||||
}
|
||||
|
||||
fiber.transfer() // expect: transferred
|
||||
IO.print("main") // expect: main
|
||||
System.print("main") // expect: main
|
||||
fiber.call("value") // expect: value
|
||||
// expect: called
|
||||
|
||||
@@ -2,6 +2,6 @@ var fiber = Fiber.new {
|
||||
"s".unknown
|
||||
}
|
||||
|
||||
IO.print(fiber.error) // expect: null
|
||||
IO.print(fiber.try()) // expect: String does not implement 'unknown'.
|
||||
IO.print(fiber.error) // expect: String does not implement 'unknown'.
|
||||
System.print(fiber.error) // expect: null
|
||||
System.print(fiber.try()) // expect: String does not implement 'unknown'.
|
||||
System.print(fiber.error) // expect: String does not implement 'unknown'.
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
var fiber = Fiber.new {
|
||||
IO.print("1")
|
||||
System.print("1")
|
||||
Fiber.yield()
|
||||
IO.print("2")
|
||||
System.print("2")
|
||||
}
|
||||
|
||||
IO.print(fiber.isDone) // expect: false
|
||||
System.print(fiber.isDone) // expect: false
|
||||
fiber.call() // expect: 1
|
||||
IO.print(fiber.isDone) // expect: false
|
||||
System.print(fiber.isDone) // expect: false
|
||||
fiber.call() // expect: 2
|
||||
IO.print(fiber.isDone) // expect: true
|
||||
System.print(fiber.isDone) // expect: true
|
||||
|
||||
@@ -3,4 +3,4 @@ var fiber = Fiber.new {
|
||||
}
|
||||
|
||||
fiber.try()
|
||||
IO.print(fiber.isDone) // expect: true
|
||||
System.print(fiber.isDone) // expect: true
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
var b = Fiber.new {
|
||||
IO.print("fiber b")
|
||||
System.print("fiber b")
|
||||
}
|
||||
|
||||
var a = Fiber.new {
|
||||
IO.print("begin fiber a")
|
||||
System.print("begin fiber a")
|
||||
b.call()
|
||||
IO.print("end fiber a")
|
||||
System.print("end fiber a")
|
||||
}
|
||||
|
||||
IO.print("begin main")
|
||||
System.print("begin main")
|
||||
a.call()
|
||||
IO.print("end main")
|
||||
System.print("end main")
|
||||
|
||||
// expect: begin main
|
||||
// expect: begin fiber a
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
var a = Fiber.new {
|
||||
IO.print("a")
|
||||
System.print("a")
|
||||
}
|
||||
|
||||
var b = Fiber.new {
|
||||
IO.print("b before")
|
||||
System.print("b before")
|
||||
a.transfer()
|
||||
IO.print("b after")
|
||||
System.print("b after")
|
||||
}
|
||||
|
||||
var c = Fiber.new {
|
||||
IO.print("c before")
|
||||
System.print("c before")
|
||||
b.transfer()
|
||||
IO.print("c after")
|
||||
System.print("c after")
|
||||
}
|
||||
|
||||
IO.print("start") // expect: start
|
||||
System.print("start") // expect: start
|
||||
|
||||
c.transfer()
|
||||
// expect: c before
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
var F = Fiber.new {
|
||||
IO.print(1) // expect: 1
|
||||
IO.print(F.transfer()) // expect: null
|
||||
IO.print(2) // expect: 2
|
||||
System.print(1) // expect: 1
|
||||
System.print(F.transfer()) // expect: null
|
||||
System.print(2) // expect: 2
|
||||
}
|
||||
|
||||
F.call()
|
||||
// F remembers its original caller so transfers back to main.
|
||||
IO.print(3) // expect: 3
|
||||
System.print(3) // expect: 3
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
var A = Fiber.new {
|
||||
IO.print(2)
|
||||
System.print(2)
|
||||
B.transfer()
|
||||
IO.print("nope")
|
||||
System.print("nope")
|
||||
}
|
||||
|
||||
var B = Fiber.new {
|
||||
IO.print(1)
|
||||
System.print(1)
|
||||
A.transfer()
|
||||
IO.print(3)
|
||||
System.print(3)
|
||||
}
|
||||
|
||||
B.call()
|
||||
@@ -15,4 +15,4 @@ B.call()
|
||||
// expect: 2
|
||||
// expect: 3
|
||||
// B remembers its original caller so returns to main.
|
||||
IO.print(4) // expect: 4
|
||||
System.print(4) // expect: 4
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
var main = Fiber.current
|
||||
|
||||
var fiber = Fiber.new {
|
||||
IO.print("fiber 1")
|
||||
IO.print(main.transfer())
|
||||
System.print("fiber 1")
|
||||
System.print(main.transfer())
|
||||
|
||||
// Yield to bounce back to main and clear the caller so we don't get a
|
||||
// double call() error below.
|
||||
Fiber.yield()
|
||||
|
||||
IO.print(main.transfer())
|
||||
System.print(main.transfer())
|
||||
}
|
||||
|
||||
fiber.transfer() // expect: fiber 1
|
||||
IO.print("main 1") // expect: main 1
|
||||
System.print("main 1") // expect: main 1
|
||||
fiber.call("call 1") // expect: call 1
|
||||
|
||||
IO.print("main 2") // expect: main 2
|
||||
System.print("main 2") // expect: main 2
|
||||
// Transfer back into the fiber so it has a NULL caller.
|
||||
fiber.transfer()
|
||||
|
||||
fiber.call() // expect: null
|
||||
IO.print("main 3") // expect: main 3
|
||||
System.print("main 3") // expect: main 3
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
var main = Fiber.current
|
||||
|
||||
var fiber = Fiber.new {
|
||||
IO.print("fiber")
|
||||
IO.print(main.transfer())
|
||||
System.print("fiber")
|
||||
System.print(main.transfer())
|
||||
}
|
||||
|
||||
fiber.transfer() // expect: fiber
|
||||
IO.print("main") // expect: main
|
||||
System.print("main") // expect: main
|
||||
fiber.transfer("transfer") // expect: transfer
|
||||
|
||||
// This does not get run since we exit when the transferred fiber completes.
|
||||
IO.print("nope")
|
||||
System.print("nope")
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
var a = Fiber.new {
|
||||
IO.print("run")
|
||||
System.print("run")
|
||||
}
|
||||
|
||||
a.call() // expect: run
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
var a = Fiber.new {
|
||||
Fiber.abort("Error!")
|
||||
IO.print("should not get here")
|
||||
System.print("should not get here")
|
||||
}
|
||||
|
||||
a.try()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
var fiber = Fiber.new {
|
||||
IO.print("called")
|
||||
IO.print(Fiber.yield())
|
||||
IO.print("transferred")
|
||||
System.print("called")
|
||||
System.print(Fiber.yield())
|
||||
System.print("transferred")
|
||||
}
|
||||
|
||||
fiber.call() // expect: called
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
var a = Fiber.new {
|
||||
IO.print("a")
|
||||
System.print("a")
|
||||
}
|
||||
|
||||
var b = Fiber.new {
|
||||
IO.print("b before")
|
||||
System.print("b before")
|
||||
a.transfer("ignored")
|
||||
IO.print("b after")
|
||||
System.print("b after")
|
||||
}
|
||||
|
||||
var c = Fiber.new {
|
||||
IO.print("c before")
|
||||
System.print("c before")
|
||||
b.transfer("ignored")
|
||||
IO.print("c after")
|
||||
System.print("c after")
|
||||
}
|
||||
|
||||
IO.print("start") // expect: start
|
||||
System.print("start") // expect: start
|
||||
|
||||
c.transfer("ignored")
|
||||
// expect: c before
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
var F = Fiber.new {
|
||||
IO.print(1) // expect: 1
|
||||
IO.print(F.transfer("value")) // expect: value
|
||||
IO.print(2) // expect: 2
|
||||
System.print(1) // expect: 1
|
||||
System.print(F.transfer("value")) // expect: value
|
||||
System.print(2) // expect: 2
|
||||
}
|
||||
|
||||
F.call()
|
||||
IO.print(3) // expect: 3
|
||||
System.print(3) // expect: 3
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
var A = Fiber.new {
|
||||
IO.print(2)
|
||||
System.print(2)
|
||||
B.transfer("ignored")
|
||||
IO.print("nope")
|
||||
System.print("nope")
|
||||
}
|
||||
|
||||
var B = Fiber.new {
|
||||
IO.print(1)
|
||||
System.print(1)
|
||||
A.transfer("ignored")
|
||||
IO.print(3)
|
||||
System.print(3)
|
||||
}
|
||||
|
||||
B.call()
|
||||
// expect: 1
|
||||
// expect: 2
|
||||
// expect: 3
|
||||
IO.print(4) // expect: 4
|
||||
System.print(4) // expect: 4
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
var a = Fiber.new {
|
||||
IO.print("run")
|
||||
System.print("run")
|
||||
}
|
||||
|
||||
a.call() // expect: run
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
var a = Fiber.new {
|
||||
Fiber.abort("Error!")
|
||||
IO.print("should not get here")
|
||||
System.print("should not get here")
|
||||
}
|
||||
|
||||
a.try()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
var fiber = Fiber.new {
|
||||
IO.print("called")
|
||||
IO.print(Fiber.yield())
|
||||
IO.print("transferred")
|
||||
System.print("called")
|
||||
System.print(Fiber.yield())
|
||||
System.print("transferred")
|
||||
}
|
||||
|
||||
fiber.call() // expect: called
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
var fiber = Fiber.new {
|
||||
IO.print("before")
|
||||
System.print("before")
|
||||
true.unknownMethod
|
||||
IO.print("after")
|
||||
System.print("after")
|
||||
}
|
||||
|
||||
IO.print(fiber.try())
|
||||
System.print(fiber.try())
|
||||
// expect: before
|
||||
// expect: Bool does not implement 'unknownMethod'.
|
||||
IO.print("after try") // expect: after try
|
||||
System.print("after try") // expect: after try
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
var fiber = Fiber.new {
|
||||
IO.print("try")
|
||||
System.print("try")
|
||||
}
|
||||
|
||||
fiber.try() // expect: try
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
var fiber = Fiber.new {
|
||||
IO.print("fiber")
|
||||
System.print("fiber")
|
||||
}
|
||||
|
||||
IO.print("before") // expect: before
|
||||
IO.print(fiber.try()) // expect: fiber
|
||||
System.print("before") // expect: before
|
||||
System.print(fiber.try()) // expect: fiber
|
||||
// expect: null
|
||||
IO.print("after") // expect: after
|
||||
System.print("after") // expect: after
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
var fiber = Fiber.new {}
|
||||
IO.print(fiber is Fiber) // expect: true
|
||||
IO.print(fiber is Object) // expect: true
|
||||
IO.print(fiber is Bool) // expect: false
|
||||
IO.print(fiber.type == Fiber) // expect: true
|
||||
System.print(fiber is Fiber) // expect: true
|
||||
System.print(fiber is Object) // expect: true
|
||||
System.print(fiber is Bool) // expect: false
|
||||
System.print(fiber.type == Fiber) // expect: true
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
var fiber = Fiber.new {
|
||||
IO.print("fiber 1")
|
||||
System.print("fiber 1")
|
||||
Fiber.yield()
|
||||
IO.print("fiber 2")
|
||||
System.print("fiber 2")
|
||||
Fiber.yield()
|
||||
IO.print("fiber 3")
|
||||
System.print("fiber 3")
|
||||
}
|
||||
|
||||
fiber.call() // expect: fiber 1
|
||||
IO.print("main 1") // expect: main 1
|
||||
System.print("main 1") // expect: main 1
|
||||
fiber.call() // expect: fiber 2
|
||||
IO.print("main 2") // expect: main 2
|
||||
System.print("main 2") // expect: main 2
|
||||
fiber.call() // expect: fiber 3
|
||||
IO.print("main 3") // expect: main 3
|
||||
System.print("main 3") // expect: main 3
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
IO.print("before") // expect: before
|
||||
System.print("before") // expect: before
|
||||
Fiber.yield()
|
||||
IO.print("not reached")
|
||||
System.print("not reached")
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
var fiber = Fiber.new {
|
||||
IO.print("fiber 1")
|
||||
IO.print(Fiber.yield())
|
||||
IO.print(Fiber.yield())
|
||||
System.print("fiber 1")
|
||||
System.print(Fiber.yield())
|
||||
System.print(Fiber.yield())
|
||||
}
|
||||
|
||||
fiber.call() // expect: fiber 1
|
||||
IO.print("main 1") // expect: main 1
|
||||
System.print("main 1") // expect: main 1
|
||||
fiber.call("call 1") // expect: call 1
|
||||
IO.print("main 2") // expect: main 2
|
||||
System.print("main 2") // expect: main 2
|
||||
fiber.call() // expect: null
|
||||
IO.print("main 3") // expect: main 3
|
||||
System.print("main 3") // expect: main 3
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
var main = Fiber.current
|
||||
|
||||
var a = Fiber.new {
|
||||
IO.print("a")
|
||||
IO.print(Fiber.yield())
|
||||
System.print("a")
|
||||
System.print(Fiber.yield())
|
||||
}
|
||||
|
||||
var b = Fiber.new {
|
||||
IO.print("b")
|
||||
IO.print(Fiber.yield())
|
||||
System.print("b")
|
||||
System.print(Fiber.yield())
|
||||
|
||||
a.call()
|
||||
a.transfer("value")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
var a = Fiber.new {
|
||||
IO.print("before") // expect: before
|
||||
System.print("before") // expect: before
|
||||
Fiber.yield()
|
||||
IO.print("not reached")
|
||||
System.print("not reached")
|
||||
}
|
||||
|
||||
// Transfer through a chain of fibers. Since none of them are called, they all
|
||||
@@ -9,4 +9,4 @@ var a = Fiber.new {
|
||||
var b = Fiber.new { a.transfer() }
|
||||
var c = Fiber.new { b.transfer() }
|
||||
c.transfer()
|
||||
IO.print("not reached")
|
||||
System.print("not reached")
|
||||
@@ -1,14 +1,14 @@
|
||||
var fiber = Fiber.new {
|
||||
IO.print("fiber 1")
|
||||
System.print("fiber 1")
|
||||
Fiber.yield("yield 1")
|
||||
IO.print("fiber 2")
|
||||
System.print("fiber 2")
|
||||
Fiber.yield("yield 2")
|
||||
IO.print("fiber 3")
|
||||
System.print("fiber 3")
|
||||
}
|
||||
|
||||
IO.print(fiber.call()) // expect: fiber 1
|
||||
System.print(fiber.call()) // expect: fiber 1
|
||||
// expect: yield 1
|
||||
IO.print(fiber.call()) // expect: fiber 2
|
||||
System.print(fiber.call()) // expect: fiber 2
|
||||
// expect: yield 2
|
||||
IO.print(fiber.call()) // expect: fiber 3
|
||||
System.print(fiber.call()) // expect: fiber 3
|
||||
// expect: null
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
IO.print("before") // expect: before
|
||||
System.print("before") // expect: before
|
||||
Fiber.yield(1)
|
||||
IO.print("not reached")
|
||||
System.print("not reached")
|
||||
@@ -1,7 +1,7 @@
|
||||
var a = Fiber.new {
|
||||
IO.print("before") // expect: before
|
||||
System.print("before") // expect: before
|
||||
Fiber.yield(1)
|
||||
IO.print("not reached")
|
||||
System.print("not reached")
|
||||
}
|
||||
|
||||
// Transfer through a chain of fibers. Since none of them are called, they all
|
||||
@@ -9,4 +9,4 @@ var a = Fiber.new {
|
||||
var b = Fiber.new { a.transfer() }
|
||||
var c = Fiber.new { b.transfer() }
|
||||
c.transfer()
|
||||
IO.print("not reached")
|
||||
System.print("not reached")
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
IO.print(Fn.new {}.arity) // expect: 0
|
||||
IO.print(Fn.new {|a| a}.arity) // expect: 1
|
||||
IO.print(Fn.new {|a, b| a}.arity) // expect: 2
|
||||
IO.print(Fn.new {|a, b, c| a}.arity) // expect: 3
|
||||
IO.print(Fn.new {|a, b, c, d| a}.arity) // expect: 4
|
||||
System.print(Fn.new {}.arity) // expect: 0
|
||||
System.print(Fn.new {|a| a}.arity) // expect: 1
|
||||
System.print(Fn.new {|a, b| a}.arity) // expect: 2
|
||||
System.print(Fn.new {|a, b, c| a}.arity) // expect: 3
|
||||
System.print(Fn.new {|a, b, c, d| a}.arity) // expect: 4
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
var f0 = Fn.new { IO.print("zero") }
|
||||
var f1 = Fn.new {|a| IO.print("one ", a) }
|
||||
var f2 = Fn.new {|a, b| IO.print("two ", a, " ", b) }
|
||||
var f3 = Fn.new {|a, b, c| IO.print("three ", a, " ", b, " ", c) }
|
||||
var f0 = Fn.new { System.print("zero") }
|
||||
var f1 = Fn.new {|a| System.print("one " + a) }
|
||||
var f2 = Fn.new {|a, b| System.print("two " + a + " " + b) }
|
||||
var f3 = Fn.new {|a, b, c| System.print("three " + a + " " + b + " " + c) }
|
||||
|
||||
f0.call("a") // expect: zero
|
||||
f0.call("a", "b") // expect: zero
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
var f2 = Fn.new {|a, b| IO.print(a, b) }
|
||||
var f2 = Fn.new {|a, b| System.print(a, b) }
|
||||
f2.call("a") // expect runtime error: Function expects more arguments.
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
// Not structurally equal.
|
||||
IO.print(Fn.new { 123 } == Fn.new { 123 }) // expect: false
|
||||
IO.print(Fn.new { 123 } != Fn.new { 123 }) // expect: true
|
||||
System.print(Fn.new { 123 } == Fn.new { 123 }) // expect: false
|
||||
System.print(Fn.new { 123 } != Fn.new { 123 }) // expect: true
|
||||
|
||||
// Not equal to other types.
|
||||
IO.print(Fn.new { 123 } == 1) // expect: false
|
||||
IO.print(Fn.new { 123 } == false) // expect: false
|
||||
IO.print(Fn.new { 123 } == "fn 123") // expect: false
|
||||
IO.print(Fn.new { 123 } != 1) // expect: true
|
||||
IO.print(Fn.new { 123 } != false) // expect: true
|
||||
IO.print(Fn.new { 123 } != "fn 123") // expect: true
|
||||
System.print(Fn.new { 123 } == 1) // expect: false
|
||||
System.print(Fn.new { 123 } == false) // expect: false
|
||||
System.print(Fn.new { 123 } == "fn 123") // expect: false
|
||||
System.print(Fn.new { 123 } != 1) // expect: true
|
||||
System.print(Fn.new { 123 } != false) // expect: true
|
||||
System.print(Fn.new { 123 } != "fn 123") // expect: true
|
||||
|
||||
// Equal by identity.
|
||||
var f = Fn.new { 123 }
|
||||
IO.print(f == f) // expect: true
|
||||
IO.print(f != f) // expect: false
|
||||
System.print(f == f) // expect: true
|
||||
System.print(f != f) // expect: false
|
||||
|
||||
@@ -1 +1 @@
|
||||
IO.print(Fn.new {}) // expect: <fn>
|
||||
System.print(Fn.new {}) // expect: <fn>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
IO.print(Fn.new { 0 } is Fn) // expect: true
|
||||
IO.print(Fn.new { 0 } is Object) // expect: true
|
||||
IO.print(Fn.new { 0 } is String) // expect: false
|
||||
IO.print(Fn.new { 0 }.type == Fn) // expect: true
|
||||
System.print(Fn.new { 0 } is Fn) // expect: true
|
||||
System.print(Fn.new { 0 } is Object) // expect: true
|
||||
System.print(Fn.new { 0 } is String) // expect: false
|
||||
System.print(Fn.new { 0 }.type == Fn) // expect: true
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
var a = [1]
|
||||
a.add(2)
|
||||
IO.print(a) // expect: [1, 2]
|
||||
System.print(a) // expect: [1, 2]
|
||||
a.add(3)
|
||||
IO.print(a) // expect: [1, 2, 3]
|
||||
System.print(a) // expect: [1, 2, 3]
|
||||
|
||||
// Returns added element.
|
||||
IO.print(a.add(4)) // expect: 4
|
||||
System.print(a.add(4)) // expect: 4
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
var a = [1]
|
||||
a.addAll([2, 3])
|
||||
IO.print(a) // expect: [1, 2, 3]
|
||||
System.print(a) // expect: [1, 2, 3]
|
||||
a.addAll([])
|
||||
IO.print(a) // expect: [1, 2, 3]
|
||||
System.print(a) // expect: [1, 2, 3]
|
||||
a.addAll(4..6)
|
||||
IO.print(a) // expect: [1, 2, 3, 4, 5, 6]
|
||||
System.print(a) // expect: [1, 2, 3, 4, 5, 6]
|
||||
|
||||
// Returns argument.
|
||||
var range = 7..9
|
||||
IO.print(a.addAll(range) == range) // expect: true
|
||||
System.print(a.addAll(range) == range) // expect: true
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
var a = [1, 2, 3]
|
||||
a.clear()
|
||||
IO.print(a) // expect: []
|
||||
IO.print(a.count) // expect: 0
|
||||
System.print(a) // expect: []
|
||||
System.print(a.count) // expect: 0
|
||||
|
||||
// Returns null.
|
||||
IO.print([1, 2].clear()) // expect: null
|
||||
System.print([1, 2].clear()) // expect: null
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
var list = [1, 2, 3, 4, "foo"]
|
||||
|
||||
IO.print(list.contains(2)) // expect: true
|
||||
IO.print(list.contains(5)) // expect: false
|
||||
IO.print(list.contains("foo")) // expect: true
|
||||
IO.print(list.contains("bar")) // expect: false
|
||||
System.print(list.contains(2)) // expect: true
|
||||
System.print(list.contains(5)) // expect: false
|
||||
System.print(list.contains("foo")) // expect: true
|
||||
System.print(list.contains("bar")) // expect: false
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
IO.print([].count) // expect: 0
|
||||
IO.print([1].count) // expect: 1
|
||||
IO.print([1, 2, 3, 4].count) // expect: 4
|
||||
System.print([].count) // expect: 0
|
||||
System.print([1].count) // expect: 1
|
||||
System.print([1, 2, 3, 4].count) // expect: 4
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
var a = [1, 2, 3]
|
||||
|
||||
IO.print(a.count {|x| x > 3 }) // expect: 0
|
||||
IO.print(a.count {|x| x > 1 }) // expect: 2
|
||||
System.print(a.count {|x| x > 3 }) // expect: 0
|
||||
System.print(a.count {|x| x > 1 }) // expect: 2
|
||||
|
||||
IO.print([].count {|x| true }) // expect: 0
|
||||
System.print([].count {|x| true }) // expect: 0
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
var a = [1, 2, 3]
|
||||
|
||||
IO.print(a.count {|x| "truthy" }) // expect: 3
|
||||
System.print(a.count {|x| "truthy" }) // expect: 3
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
var words = ""
|
||||
["One", "Two", "Three"].each {|word| words = words + word }
|
||||
IO.print(words) // expect: OneTwoThree
|
||||
System.print(words) // expect: OneTwoThree
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
var i = 0
|
||||
[].each {|item| i = i + 1 }
|
||||
IO.print(i) // expect: 0
|
||||
System.print(i) // expect: 0
|
||||
|
||||
+10
-10
@@ -1,41 +1,41 @@
|
||||
// Add to empty list.
|
||||
var a = []
|
||||
a.insert(0, 1)
|
||||
IO.print(a) // expect: [1]
|
||||
System.print(a) // expect: [1]
|
||||
|
||||
// Normal indices.
|
||||
var b = [1, 2, 3]
|
||||
b.insert(0, 4)
|
||||
IO.print(b) // expect: [4, 1, 2, 3]
|
||||
System.print(b) // expect: [4, 1, 2, 3]
|
||||
|
||||
var c = [1, 2, 3]
|
||||
c.insert(1, 4)
|
||||
IO.print(c) // expect: [1, 4, 2, 3]
|
||||
System.print(c) // expect: [1, 4, 2, 3]
|
||||
|
||||
var d = [1, 2, 3]
|
||||
d.insert(2, 4)
|
||||
IO.print(d) // expect: [1, 2, 4, 3]
|
||||
System.print(d) // expect: [1, 2, 4, 3]
|
||||
|
||||
var e = [1, 2, 3]
|
||||
e.insert(3, 4)
|
||||
IO.print(e) // expect: [1, 2, 3, 4]
|
||||
System.print(e) // expect: [1, 2, 3, 4]
|
||||
|
||||
// Negative indices.
|
||||
var f = [1, 2, 3]
|
||||
f.insert(-4, 4)
|
||||
IO.print(f) // expect: [4, 1, 2, 3]
|
||||
System.print(f) // expect: [4, 1, 2, 3]
|
||||
|
||||
var g = [1, 2, 3]
|
||||
g.insert(-3, 4)
|
||||
IO.print(g) // expect: [1, 4, 2, 3]
|
||||
System.print(g) // expect: [1, 4, 2, 3]
|
||||
|
||||
var h = [1, 2, 3]
|
||||
h.insert(-2, 4)
|
||||
IO.print(h) // expect: [1, 2, 4, 3]
|
||||
System.print(h) // expect: [1, 2, 4, 3]
|
||||
|
||||
var i = [1, 2, 3]
|
||||
i.insert(-1, 4)
|
||||
IO.print(i) // expect: [1, 2, 3, 4]
|
||||
System.print(i) // expect: [1, 2, 3, 4]
|
||||
|
||||
// Returns.inserted value.
|
||||
IO.print([1, 2].insert(0, 3)) // expect: 3
|
||||
System.print([1, 2].insert(0, 3)) // expect: 3
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
var a = ["one", "two", "three", "four"]
|
||||
IO.print(a.iterate(null)) // expect: 0
|
||||
IO.print(a.iterate(0)) // expect: 1
|
||||
IO.print(a.iterate(1)) // expect: 2
|
||||
IO.print(a.iterate(2)) // expect: 3
|
||||
IO.print(a.iterate(3)) // expect: false
|
||||
System.print(a.iterate(null)) // expect: 0
|
||||
System.print(a.iterate(0)) // expect: 1
|
||||
System.print(a.iterate(1)) // expect: 2
|
||||
System.print(a.iterate(2)) // expect: 3
|
||||
System.print(a.iterate(3)) // expect: false
|
||||
|
||||
// Out of bounds.
|
||||
IO.print(a.iterate(123)) // expect: false
|
||||
IO.print(a.iterate(-1)) // expect: false
|
||||
System.print(a.iterate(123)) // expect: false
|
||||
System.print(a.iterate(-1)) // expect: false
|
||||
|
||||
// Nothing to iterate in an empty list.
|
||||
IO.print([].iterate(null)) // expect: false
|
||||
System.print([].iterate(null)) // expect: false
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
var a = ["one", "two", "three", "four"]
|
||||
IO.print(a.iteratorValue(0)) // expect: one
|
||||
IO.print(a.iteratorValue(1)) // expect: two
|
||||
IO.print(a.iteratorValue(2)) // expect: three
|
||||
IO.print(a.iteratorValue(3)) // expect: four
|
||||
System.print(a.iteratorValue(0)) // expect: one
|
||||
System.print(a.iteratorValue(1)) // expect: two
|
||||
System.print(a.iteratorValue(2)) // expect: three
|
||||
System.print(a.iteratorValue(3)) // expect: four
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
// Handle empty list.
|
||||
IO.print([].join(",") == "") // expect: true
|
||||
System.print([].join(",") == "") // expect: true
|
||||
|
||||
// Handle a simple list with an empty delimeter.
|
||||
IO.print([1, 2, 3].join("")) // expect: 123
|
||||
System.print([1, 2, 3].join("")) // expect: 123
|
||||
|
||||
// Handle a simple list with no separator.
|
||||
IO.print([1, 2, 3].join) // expect: 123
|
||||
System.print([1, 2, 3].join) // expect: 123
|
||||
|
||||
// Does not quote strings.
|
||||
IO.print([1, "2", true].join(",")) // expect: 1,2,true
|
||||
System.print([1, "2", true].join(",")) // expect: 1,2,true
|
||||
|
||||
// Nested lists.
|
||||
IO.print([1, [2, [3], 4], 5].join(",")) // expect: 1,[2, [3], 4],5
|
||||
System.print([1, [2, [3], 4], 5].join(",")) // expect: 1,[2, [3], 4],5
|
||||
|
||||
// Calls toString on elements.
|
||||
class Foo {
|
||||
@@ -19,6 +19,6 @@ class Foo {
|
||||
toString { "Foo.toString" }
|
||||
}
|
||||
|
||||
IO.print([1, Foo.new(), 2].join(", ")) // expect: 1, Foo.toString, 2
|
||||
System.print([1, Foo.new(), 2].join(", ")) // expect: 1, Foo.toString, 2
|
||||
|
||||
// TODO: Handle lists that contain themselves.
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
var a = [1, 2, 3]
|
||||
var b = a.map {|x| x + 1 }.toList
|
||||
IO.print(b) // expect: [2, 3, 4]
|
||||
System.print(b) // expect: [2, 3, 4]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
var list = List.new()
|
||||
|
||||
IO.print(list.count) // expect: 0
|
||||
IO.print(list) // expect: []
|
||||
System.print(list.count) // expect: 0
|
||||
System.print(list) // expect: []
|
||||
list.add(1)
|
||||
IO.print(list) // expect: [1]
|
||||
System.print(list) // expect: [1]
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
IO.print(![1, 2]) // expect: false
|
||||
IO.print(![]) // expect: false
|
||||
System.print(![1, 2]) // expect: false
|
||||
System.print(![]) // expect: false
|
||||
|
||||
@@ -6,13 +6,13 @@ var e = a + []
|
||||
var f = [] + a
|
||||
var g = [] + []
|
||||
|
||||
IO.print(a) // expect: [1, 2, 3]
|
||||
IO.print(b) // expect: [4, 5, 6]
|
||||
IO.print(c) // expect: [1, 2, 3, 4, 5, 6]
|
||||
IO.print(d) // expect: [1, 2, 3, 4, 5, 6]
|
||||
IO.print(e) // expect: [1, 2, 3]
|
||||
IO.print(f) // expect: [1, 2, 3]
|
||||
IO.print(g) // expect: []
|
||||
System.print(a) // expect: [1, 2, 3]
|
||||
System.print(b) // expect: [4, 5, 6]
|
||||
System.print(c) // expect: [1, 2, 3, 4, 5, 6]
|
||||
System.print(d) // expect: [1, 2, 3, 4, 5, 6]
|
||||
System.print(e) // expect: [1, 2, 3]
|
||||
System.print(f) // expect: [1, 2, 3]
|
||||
System.print(g) // expect: []
|
||||
|
||||
// Doesn't modify original list.
|
||||
IO.print(a) // expect: [1, 2, 3]
|
||||
System.print(a) // expect: [1, 2, 3]
|
||||
|
||||
@@ -3,12 +3,12 @@ var b = ["W", "o", "r", "l", "d"]
|
||||
var max = Fn.new {|a, b| a > b ? a : b }
|
||||
var sum = Fn.new {|a, b| a + b }
|
||||
|
||||
IO.print(a.reduce(max)) // expect: 5
|
||||
IO.print(a.reduce(10, max)) // expect: 10
|
||||
System.print(a.reduce(max)) // expect: 5
|
||||
System.print(a.reduce(10, max)) // expect: 10
|
||||
|
||||
IO.print(a.reduce(sum)) // expect: 13
|
||||
IO.print(a.reduce(-1, sum)) // expect: 12
|
||||
System.print(a.reduce(sum)) // expect: 13
|
||||
System.print(a.reduce(-1, sum)) // expect: 12
|
||||
|
||||
// sum also concatenates strings
|
||||
IO.print(b.reduce("Hello ", sum)) // expect: Hello World
|
||||
IO.print(b.reduce(sum)) // expect: World
|
||||
System.print(b.reduce("Hello ", sum)) // expect: Hello World
|
||||
System.print(b.reduce(sum)) // expect: World
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
IO.print([1].reduce {|a, b| 42 }) // expect: 1
|
||||
IO.print([].reduce(1) {|a, b| 42 }) // expect: 1
|
||||
System.print([1].reduce {|a, b| 42 }) // expect: 1
|
||||
System.print([].reduce(1) {|a, b| 42 }) // expect: 1
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
var a = [1, 2, 3]
|
||||
a.removeAt(0)
|
||||
IO.print(a) // expect: [2, 3]
|
||||
System.print(a) // expect: [2, 3]
|
||||
|
||||
var b = [1, 2, 3]
|
||||
b.removeAt(1)
|
||||
IO.print(b) // expect: [1, 3]
|
||||
System.print(b) // expect: [1, 3]
|
||||
|
||||
var c = [1, 2, 3]
|
||||
c.removeAt(2)
|
||||
IO.print(c) // expect: [1, 2]
|
||||
System.print(c) // expect: [1, 2]
|
||||
|
||||
// Index backwards from end.
|
||||
var d = [1, 2, 3]
|
||||
d.removeAt(-3)
|
||||
IO.print(d) // expect: [2, 3]
|
||||
System.print(d) // expect: [2, 3]
|
||||
|
||||
var e = [1, 2, 3]
|
||||
e.removeAt(-2)
|
||||
IO.print(e) // expect: [1, 3]
|
||||
System.print(e) // expect: [1, 3]
|
||||
|
||||
var f = [1, 2, 3]
|
||||
f.removeAt(-1)
|
||||
IO.print(f) // expect: [1, 2]
|
||||
System.print(f) // expect: [1, 2]
|
||||
|
||||
// Return the removed value.
|
||||
IO.print([3, 4, 5].removeAt(1)) // expect: 4
|
||||
System.print([3, 4, 5].removeAt(1)) // expect: 4
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
// Returns elements.
|
||||
var list = ["a", "b", "c", "d"]
|
||||
IO.print(list[0]) // expect: a
|
||||
IO.print(list[1]) // expect: b
|
||||
IO.print(list[2]) // expect: c
|
||||
IO.print(list[3]) // expect: d
|
||||
System.print(list[0]) // expect: a
|
||||
System.print(list[1]) // expect: b
|
||||
System.print(list[2]) // expect: c
|
||||
System.print(list[3]) // expect: d
|
||||
|
||||
// Allows indexing backwards from the end.
|
||||
IO.print(list[-4]) // expect: a
|
||||
IO.print(list[-3]) // expect: b
|
||||
IO.print(list[-2]) // expect: c
|
||||
IO.print(list[-1]) // expect: d
|
||||
System.print(list[-4]) // expect: a
|
||||
System.print(list[-3]) // expect: b
|
||||
System.print(list[-2]) // expect: c
|
||||
System.print(list[-1]) // expect: d
|
||||
|
||||
@@ -1,35 +1,35 @@
|
||||
// Returns lists.
|
||||
var list = ["a", "b", "c", "d", "e"]
|
||||
IO.print(list[0..0]) // expect: [a]
|
||||
IO.print(list[1...1]) // expect: []
|
||||
IO.print(list[1..2]) // expect: [b, c]
|
||||
IO.print(list[1...2]) // expect: [b]
|
||||
IO.print(list[2..4]) // expect: [c, d, e]
|
||||
IO.print(list[2...5]) // expect: [c, d, e]
|
||||
System.print(list[0..0]) // expect: [a]
|
||||
System.print(list[1...1]) // expect: []
|
||||
System.print(list[1..2]) // expect: [b, c]
|
||||
System.print(list[1...2]) // expect: [b]
|
||||
System.print(list[2..4]) // expect: [c, d, e]
|
||||
System.print(list[2...5]) // expect: [c, d, e]
|
||||
|
||||
// A backwards range reverses.
|
||||
IO.print(list[3..1]) // expect: [d, c, b]
|
||||
IO.print(list[3...1]) // expect: [d, c]
|
||||
IO.print(list[3...3]) // expect: []
|
||||
System.print(list[3..1]) // expect: [d, c, b]
|
||||
System.print(list[3...1]) // expect: [d, c]
|
||||
System.print(list[3...3]) // expect: []
|
||||
|
||||
// Negative ranges index from the end.
|
||||
IO.print(list[-5..-2]) // expect: [a, b, c, d]
|
||||
IO.print(list[-5...-2]) // expect: [a, b, c]
|
||||
IO.print(list[-3..-5]) // expect: [c, b, a]
|
||||
IO.print(list[-3...-6]) // expect: [c, b, a]
|
||||
System.print(list[-5..-2]) // expect: [a, b, c, d]
|
||||
System.print(list[-5...-2]) // expect: [a, b, c]
|
||||
System.print(list[-3..-5]) // expect: [c, b, a]
|
||||
System.print(list[-3...-6]) // expect: [c, b, a]
|
||||
|
||||
// Half-negative ranges are treated like the negative value is fixed before
|
||||
// walking the range.
|
||||
IO.print(list[-5..3]) // expect: [a, b, c, d]
|
||||
IO.print(list[-3...5]) // expect: [c, d, e]
|
||||
IO.print(list[-2..1]) // expect: [d, c, b]
|
||||
IO.print(list[-2...0]) // expect: [d, c, b]
|
||||
System.print(list[-5..3]) // expect: [a, b, c, d]
|
||||
System.print(list[-3...5]) // expect: [c, d, e]
|
||||
System.print(list[-2..1]) // expect: [d, c, b]
|
||||
System.print(list[-2...0]) // expect: [d, c, b]
|
||||
|
||||
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]
|
||||
System.print(list[1..-2]) // expect: [b, c, d]
|
||||
System.print(list[2...-1]) // expect: [c, d]
|
||||
System.print(list[4..-5]) // expect: [e, d, c, b, a]
|
||||
System.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: []
|
||||
System.print([][0...0]) // expect: []
|
||||
System.print([][0..-1]) // expect: []
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
list[0] = 5
|
||||
list[1] = 6
|
||||
list[2] = 7
|
||||
IO.print(list) // expect: [5, 6, 7]
|
||||
System.print(list) // expect: [5, 6, 7]
|
||||
}
|
||||
|
||||
// Returns right-hand side.
|
||||
{
|
||||
var list = [1, 2, 3]
|
||||
IO.print(list[1] = 5) // expect: 5
|
||||
System.print(list[1] = 5) // expect: 5
|
||||
}
|
||||
|
||||
// Negative indices.
|
||||
@@ -19,5 +19,5 @@
|
||||
list[-1] = 5
|
||||
list[-2] = 6
|
||||
list[-3] = 7
|
||||
IO.print(list) // expect: [7, 6, 5]
|
||||
System.print(list) // expect: [7, 6, 5]
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// Handle empty list.
|
||||
IO.print([].toString) // expect: []
|
||||
System.print([].toString) // expect: []
|
||||
|
||||
// Does not quote strings.
|
||||
IO.print([1, "2", true].toString) // expect: [1, 2, true]
|
||||
System.print([1, "2", true].toString) // expect: [1, 2, true]
|
||||
|
||||
// Nested lists.
|
||||
IO.print([1, [2, [3], 4], 5]) // expect: [1, [2, [3], 4], 5]
|
||||
System.print([1, [2, [3], 4], 5]) // expect: [1, [2, [3], 4], 5]
|
||||
|
||||
// Calls toString on elements.
|
||||
class Foo {
|
||||
@@ -13,6 +13,6 @@ class Foo {
|
||||
toString { "Foo.toString" }
|
||||
}
|
||||
|
||||
IO.print([1, Foo.new(), 2]) // expect: [1, Foo.toString, 2]
|
||||
System.print([1, Foo.new(), 2]) // expect: [1, Foo.toString, 2]
|
||||
|
||||
// TODO: Handle lists that contain themselves.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
IO.print([] is List) // expect: true
|
||||
IO.print([] is Sequence) // expect: true
|
||||
IO.print([] is Object) // expect: true
|
||||
IO.print([] is Bool) // expect: false
|
||||
IO.print([].type == List) // expect: true
|
||||
System.print([] is List) // expect: true
|
||||
System.print([] is Sequence) // expect: true
|
||||
System.print([] is Object) // expect: true
|
||||
System.print([] is Bool) // expect: false
|
||||
System.print([].type == List) // expect: true
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
var a = [1, 2, 3]
|
||||
var b = a.where {|x| x > 1 }.toList
|
||||
IO.print(b) // expect: [2, 3]
|
||||
System.print(b) // expect: [2, 3]
|
||||
|
||||
var c = a.where {|x| x > 10 }.toList
|
||||
IO.print(c) // expect: []
|
||||
System.print(c) // expect: []
|
||||
|
||||
@@ -8,4 +8,4 @@ for (i in 0...100) {
|
||||
if (i >= 10) map.remove(i - 10)
|
||||
}
|
||||
|
||||
IO.print(map.count) // expect: 10
|
||||
System.print(map.count) // expect: 10
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
var a = {1: 1, 2: 2, 3: 3}
|
||||
a.clear()
|
||||
IO.print(a) // expect: {}
|
||||
IO.print(a.count) // expect: 0
|
||||
System.print(a) // expect: {}
|
||||
System.print(a.count) // expect: 0
|
||||
|
||||
// Returns null.
|
||||
IO.print({1: 2}.clear()) // expect: null
|
||||
System.print({1: 2}.clear()) // expect: null
|
||||
|
||||
@@ -4,8 +4,8 @@ var map = {
|
||||
"three": 3
|
||||
}
|
||||
|
||||
IO.print(map.containsKey("one")) // expect: true
|
||||
IO.print(map.containsKey("two")) // expect: true
|
||||
IO.print(map.containsKey("three")) // expect: true
|
||||
IO.print(map.containsKey("four")) // expect: false
|
||||
IO.print(map.containsKey("five")) // expect: false
|
||||
System.print(map.containsKey("one")) // expect: true
|
||||
System.print(map.containsKey("two")) // expect: true
|
||||
System.print(map.containsKey("three")) // expect: true
|
||||
System.print(map.containsKey("four")) // expect: false
|
||||
System.print(map.containsKey("five")) // expect: false
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
var map = {}
|
||||
IO.print(map.count) // expect: 0
|
||||
System.print(map.count) // expect: 0
|
||||
map["one"] = "value"
|
||||
IO.print(map.count) // expect: 1
|
||||
System.print(map.count) // expect: 1
|
||||
map["two"] = "value"
|
||||
IO.print(map.count) // expect: 2
|
||||
System.print(map.count) // expect: 2
|
||||
map["three"] = "value"
|
||||
IO.print(map.count) // expect: 3
|
||||
System.print(map.count) // expect: 3
|
||||
|
||||
// Adding existing key does not increase count.
|
||||
map["two"] = "new value"
|
||||
IO.print(map.count) // expect: 3
|
||||
System.print(map.count) // expect: 3
|
||||
|
||||
@@ -2,4 +2,4 @@ var map = {
|
||||
"": "empty string"
|
||||
}
|
||||
|
||||
IO.print(map[""]) // expect: empty string
|
||||
System.print(map[""]) // expect: empty string
|
||||
|
||||
@@ -4,23 +4,23 @@ var a = {"one": 1, "two": 2, "three": 3, "four": 4}.keys
|
||||
// entry table and the hashing process isn't specified. So we just validate
|
||||
// what we can assume about them.
|
||||
|
||||
IO.print(a.iterate(null) is Num) // expect: true
|
||||
IO.print(a.iterate(null) >= 0) // expect: true
|
||||
System.print(a.iterate(null) is Num) // expect: true
|
||||
System.print(a.iterate(null) >= 0) // expect: true
|
||||
|
||||
IO.print(a.iterate(0) is Num) // expect: true
|
||||
IO.print(a.iterate(0) > 0) // expect: true
|
||||
IO.print(a.iterate(1) is Num) // expect: true
|
||||
IO.print(a.iterate(1) > 0) // expect: true
|
||||
IO.print(a.iterate(2) is Num) // expect: true
|
||||
IO.print(a.iterate(2) > 0) // expect: true
|
||||
IO.print(a.iterate(3) is Num) // expect: true
|
||||
IO.print(a.iterate(3) > 0) // expect: true
|
||||
System.print(a.iterate(0) is Num) // expect: true
|
||||
System.print(a.iterate(0) > 0) // expect: true
|
||||
System.print(a.iterate(1) is Num) // expect: true
|
||||
System.print(a.iterate(1) > 0) // expect: true
|
||||
System.print(a.iterate(2) is Num) // expect: true
|
||||
System.print(a.iterate(2) > 0) // expect: true
|
||||
System.print(a.iterate(3) is Num) // expect: true
|
||||
System.print(a.iterate(3) > 0) // expect: true
|
||||
|
||||
var previous = -1
|
||||
var iterator = a.iterate(null)
|
||||
while (iterator) {
|
||||
IO.print(iterator > previous)
|
||||
IO.print(iterator is Num)
|
||||
System.print(iterator > previous)
|
||||
System.print(iterator is Num)
|
||||
previous = iterator
|
||||
iterator = a.iterate(iterator)
|
||||
}
|
||||
@@ -38,8 +38,8 @@ while (iterator) {
|
||||
// expect: true
|
||||
|
||||
// Out of bounds.
|
||||
IO.print(a.iterate(16)) // expect: false
|
||||
IO.print(a.iterate(-1)) // expect: false
|
||||
System.print(a.iterate(16)) // expect: false
|
||||
System.print(a.iterate(-1)) // expect: false
|
||||
|
||||
// Nothing to iterate in an empty map.
|
||||
IO.print({}.keys.iterate(null)) // expect: false
|
||||
System.print({}.keys.iterate(null)) // expect: false
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user