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:
@@ -1,20 +1,20 @@
|
||||
// Note: These tests implicitly depend on ints being truthy.
|
||||
// Also rely on IO.print() returning its argument.
|
||||
// Also rely on System.print() returning its argument.
|
||||
|
||||
// Return the first non-true argument.
|
||||
IO.print(false && 1) // expect: false
|
||||
IO.print(true && 1) // expect: 1
|
||||
IO.print(1 && 2 && false) // expect: false
|
||||
System.print(false && 1) // expect: false
|
||||
System.print(true && 1) // expect: 1
|
||||
System.print(1 && 2 && false) // expect: false
|
||||
|
||||
// Return the last argument if all are true.
|
||||
IO.print(1 && true) // expect: true
|
||||
IO.print(1 && 2 && 3) // expect: 3
|
||||
System.print(1 && true) // expect: true
|
||||
System.print(1 && 2 && 3) // expect: 3
|
||||
|
||||
// Short-circuit at the first false argument.
|
||||
IO.print(true) && // expect: true
|
||||
IO.print(false) && // expect: false
|
||||
IO.print(false) // should not print
|
||||
System.print(true) && // expect: true
|
||||
System.print(false) && // expect: false
|
||||
System.print(false) // should not print
|
||||
|
||||
// Swallow a trailing newline.
|
||||
IO.print(true &&
|
||||
System.print(true &&
|
||||
true) // expect: true
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// False and null are false.
|
||||
IO.print(false && "bad") // expect: false
|
||||
IO.print(null && "bad") // expect: null
|
||||
System.print(false && "bad") // expect: false
|
||||
System.print(null && "bad") // expect: null
|
||||
|
||||
// Everything else is true.
|
||||
IO.print(true && "ok") // expect: ok
|
||||
IO.print(0 && "ok") // expect: ok
|
||||
IO.print("" && "ok") // expect: ok
|
||||
System.print(true && "ok") // expect: ok
|
||||
System.print(0 && "ok") // expect: ok
|
||||
System.print("" && "ok") // expect: ok
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
// Note: These tests implicitly depend on ints being truthy.
|
||||
// Also rely on IO.print() returning its argument.
|
||||
// Also rely on System.print() returning its argument.
|
||||
|
||||
// Return the first true argument.
|
||||
IO.print(1 || true) // expect: 1
|
||||
IO.print(false || 1) // expect: 1
|
||||
IO.print(false || false || true) // expect: true
|
||||
System.print(1 || true) // expect: 1
|
||||
System.print(false || 1) // expect: 1
|
||||
System.print(false || false || true) // expect: true
|
||||
|
||||
// Return the last argument if all are false.
|
||||
IO.print(false || false) // expect: false
|
||||
IO.print(false || false || false) // expect: false
|
||||
System.print(false || false) // expect: false
|
||||
System.print(false || false || false) // expect: false
|
||||
|
||||
// Short-circuit at the first true argument.
|
||||
IO.print(false) || // expect: false
|
||||
IO.print(true) || // expect: true
|
||||
IO.print(true) // should not print
|
||||
System.print(false) || // expect: false
|
||||
System.print(true) || // expect: true
|
||||
System.print(true) // should not print
|
||||
|
||||
// Swallow a trailing newline.
|
||||
IO.print(true ||
|
||||
System.print(true ||
|
||||
true) // expect: true
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// False and null are false.
|
||||
IO.print(false || "ok") // expect: ok
|
||||
IO.print(null || "ok") // expect: ok
|
||||
System.print(false || "ok") // expect: ok
|
||||
System.print(null || "ok") // expect: ok
|
||||
|
||||
// Everything else is true.
|
||||
IO.print(true || "ok") // expect: true
|
||||
IO.print(0 || "ok") // expect: 0
|
||||
IO.print("s" || "ok") // expect: s
|
||||
System.print(true || "ok") // expect: true
|
||||
System.print(0 || "ok") // expect: 0
|
||||
System.print("s" || "ok") // expect: s
|
||||
|
||||
Reference in New Issue
Block a user