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,34 +0,0 @@
|
||||
class Foo {
|
||||
construct new() {}
|
||||
|
||||
toString { "Foo.toString" }
|
||||
}
|
||||
|
||||
// Calls toString on argument.
|
||||
IO.print(Foo.new()) // expect: Foo.toString
|
||||
|
||||
// With one argument, returns the argument.
|
||||
IO.print(IO.print(1) == 1) // expect: 1
|
||||
// expect: true
|
||||
|
||||
// With more than one argument, returns null.
|
||||
IO.print(IO.print(1, 2) == null) // expect: 12
|
||||
// expect: true
|
||||
|
||||
// Allows multiple arguments and concatenates them.
|
||||
IO.print(1) // expect: 1
|
||||
IO.print(1, 2) // expect: 12
|
||||
IO.print(1, 2, 3) // expect: 123
|
||||
IO.print(1, 2, 3, 4) // expect: 1234
|
||||
IO.print(1, 2, 3, 4, 5) // expect: 12345
|
||||
IO.print(1, 2, 3, 4, 5, 6) // expect: 123456
|
||||
IO.print(1, 2, 3, 4, 5, 6, 7) // expect: 1234567
|
||||
IO.print(1, 2, 3, 4, 5, 6, 7, 8) // expect: 12345678
|
||||
IO.print(1, 2, 3, 4, 5, 6, 7, 8, 9) // expect: 123456789
|
||||
IO.print(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) // expect: 12345678910
|
||||
IO.print(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) // expect: 1234567891011
|
||||
IO.print(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12) // expect: 123456789101112
|
||||
IO.print(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13) // expect: 12345678910111213
|
||||
IO.print(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14) // expect: 1234567891011121314
|
||||
IO.print(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15) // expect: 123456789101112131415
|
||||
IO.print(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) // expect: 12345678910111213141516
|
||||
@@ -1,6 +0,0 @@
|
||||
class BadToString {
|
||||
construct new() {}
|
||||
toString { 3 }
|
||||
}
|
||||
|
||||
IO.print(BadToString.new()) // expect: [invalid toString]
|
||||
@@ -1,13 +0,0 @@
|
||||
var a = IO.read("a:") // stdin: first
|
||||
var b = IO.read("b:") // stdin: second
|
||||
IO.print
|
||||
// Using write() here because the read lines include the trailing newline.
|
||||
IO.write(a)
|
||||
IO.write(b)
|
||||
|
||||
// Since stdin isn't echoed back to stdout, we don't see the input lines here,
|
||||
// and there is no newline between the two prompts since that normally comes
|
||||
// from the input itself.
|
||||
// expect: a:b:
|
||||
// expect: first
|
||||
// expect: second
|
||||
@@ -1 +0,0 @@
|
||||
IO.read(null) // expect runtime error: Prompt must be a string.
|
||||
@@ -1 +0,0 @@
|
||||
IO.write(IO.read()) // expect: null
|
||||
@@ -1,7 +0,0 @@
|
||||
class BadToString {
|
||||
construct new() {}
|
||||
toString { 3 }
|
||||
}
|
||||
|
||||
IO.write(BadToString.new()) // expect: [invalid toString]
|
||||
IO.print
|
||||
Reference in New Issue
Block a user