"IO" -> "System".
Get rid of the separate opt-in IO class and replace it with a core System class. - Remove wren_io.c, wren_io.h, and io.wren. - Remove the flags that disable it. - Remove the overloads for print() with different arity. (It was an experiment, but I don't think it's that useful.) - Remove IO.read(). That will reappear using libuv in the CLI at some point. - Remove IO.time. Doesn't seem to have been used. - Update all of the tests, docs, etc. I'm sorry for all the breakage this causes, but I think "System" is a better name for this class (it makes it natural to add things like "System.gc()") and frees up "IO" for referring to the CLI's IO module.
This commit is contained in:
@@ -1,29 +1,29 @@
|
||||
var s = "abçd"
|
||||
IO.print(s.iterate(null)) // expect: 0
|
||||
IO.print(s.iterate(0)) // expect: 1
|
||||
IO.print(s.iterate(1)) // expect: 2
|
||||
System.print(s.iterate(null)) // expect: 0
|
||||
System.print(s.iterate(0)) // expect: 1
|
||||
System.print(s.iterate(1)) // expect: 2
|
||||
// Skip 3 because that's the middle of the ç sequence.
|
||||
IO.print(s.iterate(2)) // expect: 4
|
||||
System.print(s.iterate(2)) // expect: 4
|
||||
// Iterating from the middle of a UTF-8 sequence goes to the next one.
|
||||
IO.print(s.iterate(3)) // expect: 4
|
||||
IO.print(s.iterate(4)) // expect: false
|
||||
System.print(s.iterate(3)) // expect: 4
|
||||
System.print(s.iterate(4)) // expect: false
|
||||
|
||||
// Out of bounds.
|
||||
IO.print(s.iterate(123)) // expect: false
|
||||
IO.print(s.iterate(-1)) // expect: false
|
||||
System.print(s.iterate(123)) // expect: false
|
||||
System.print(s.iterate(-1)) // expect: false
|
||||
|
||||
// Nothing to iterate in an empty string.
|
||||
IO.print("".iterate(null)) // expect: false
|
||||
System.print("".iterate(null)) // expect: false
|
||||
|
||||
// 8-bit clean.
|
||||
IO.print("a\0b\0c".iterate(null)) // expect: 0
|
||||
IO.print("a\0b\0c".iterate(0)) // expect: 1
|
||||
IO.print("a\0b\0c".iterate(1)) // expect: 2
|
||||
IO.print("a\0b\0c".iterate(2)) // expect: 3
|
||||
IO.print("a\0b\0c".iterate(3)) // expect: 4
|
||||
IO.print("a\0b\0c".iterate(4)) // expect: false
|
||||
System.print("a\0b\0c".iterate(null)) // expect: 0
|
||||
System.print("a\0b\0c".iterate(0)) // expect: 1
|
||||
System.print("a\0b\0c".iterate(1)) // expect: 2
|
||||
System.print("a\0b\0c".iterate(2)) // expect: 3
|
||||
System.print("a\0b\0c".iterate(3)) // expect: 4
|
||||
System.print("a\0b\0c".iterate(4)) // expect: false
|
||||
|
||||
// Iterates over invalid UTF-8 one byte at a time.
|
||||
IO.print("\xef\xf7".iterate(null)) // expect: 0
|
||||
IO.print("\xef\xf7".iterate(0)) // expect: 1
|
||||
IO.print("\xef\xf7".iterate(1)) // expect: false
|
||||
System.print("\xef\xf7".iterate(null)) // expect: 0
|
||||
System.print("\xef\xf7".iterate(0)) // expect: 1
|
||||
System.print("\xef\xf7".iterate(1)) // expect: false
|
||||
|
||||
Reference in New Issue
Block a user