forked from Mirror/wren
"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,15 +1,15 @@
|
||||
// Simple.
|
||||
IO.print("".bytes.count) // expect: 0
|
||||
IO.print("123".bytes.count) // expect: 3
|
||||
System.print("".bytes.count) // expect: 0
|
||||
System.print("123".bytes.count) // expect: 3
|
||||
|
||||
// UTF-8.
|
||||
// Bytes:
|
||||
// 123456789
|
||||
// Chars: sø mé ஃ
|
||||
IO.print("søméஃ".bytes.count) // expect: 9
|
||||
System.print("søméஃ".bytes.count) // expect: 9
|
||||
|
||||
// Null bytes.
|
||||
IO.print("\0\0\0".bytes.count) // expect: 3
|
||||
System.print("\0\0\0".bytes.count) // expect: 3
|
||||
|
||||
// Invalid UTF-8.
|
||||
IO.print("\xef\xf7".bytes.count) // expect: 2
|
||||
System.print("\xef\xf7".bytes.count) // expect: 2
|
||||
|
||||
@ -3,19 +3,19 @@
|
||||
// Chars: sø mé ஃ
|
||||
var bytes = "søméஃ".bytes
|
||||
|
||||
IO.print(bytes.iterate(null)) // expect: 0
|
||||
IO.print("".bytes.iterate(null)) // expect: false
|
||||
System.print(bytes.iterate(null)) // expect: 0
|
||||
System.print("".bytes.iterate(null)) // expect: false
|
||||
|
||||
IO.print(bytes.iterate(0)) // expect: 1
|
||||
IO.print(bytes.iterate(1)) // expect: 2
|
||||
IO.print(bytes.iterate(2)) // expect: 3
|
||||
IO.print(bytes.iterate(3)) // expect: 4
|
||||
IO.print(bytes.iterate(4)) // expect: 5
|
||||
IO.print(bytes.iterate(5)) // expect: 6
|
||||
IO.print(bytes.iterate(6)) // expect: 7
|
||||
IO.print(bytes.iterate(7)) // expect: 8
|
||||
IO.print(bytes.iterate(8)) // expect: false
|
||||
System.print(bytes.iterate(0)) // expect: 1
|
||||
System.print(bytes.iterate(1)) // expect: 2
|
||||
System.print(bytes.iterate(2)) // expect: 3
|
||||
System.print(bytes.iterate(3)) // expect: 4
|
||||
System.print(bytes.iterate(4)) // expect: 5
|
||||
System.print(bytes.iterate(5)) // expect: 6
|
||||
System.print(bytes.iterate(6)) // expect: 7
|
||||
System.print(bytes.iterate(7)) // expect: 8
|
||||
System.print(bytes.iterate(8)) // expect: false
|
||||
|
||||
// Out of bounds.
|
||||
IO.print(bytes.iterate(123)) // expect: false
|
||||
IO.print(bytes.iterate(-1)) // expect: false
|
||||
System.print(bytes.iterate(123)) // expect: false
|
||||
System.print(bytes.iterate(-1)) // expect: false
|
||||
|
||||
@ -3,22 +3,22 @@
|
||||
// Chars: sø mé ஃ
|
||||
var bytes = "søméஃ".bytes
|
||||
|
||||
IO.print(bytes.iteratorValue(0)) // expect: 115
|
||||
IO.print(bytes.iteratorValue(1)) // expect: 195
|
||||
IO.print(bytes.iteratorValue(2)) // expect: 184
|
||||
IO.print(bytes.iteratorValue(3)) // expect: 109
|
||||
IO.print(bytes.iteratorValue(4)) // expect: 195
|
||||
IO.print(bytes.iteratorValue(5)) // expect: 169
|
||||
IO.print(bytes.iteratorValue(6)) // expect: 224
|
||||
IO.print(bytes.iteratorValue(7)) // expect: 174
|
||||
IO.print(bytes.iteratorValue(8)) // expect: 131
|
||||
System.print(bytes.iteratorValue(0)) // expect: 115
|
||||
System.print(bytes.iteratorValue(1)) // expect: 195
|
||||
System.print(bytes.iteratorValue(2)) // expect: 184
|
||||
System.print(bytes.iteratorValue(3)) // expect: 109
|
||||
System.print(bytes.iteratorValue(4)) // expect: 195
|
||||
System.print(bytes.iteratorValue(5)) // expect: 169
|
||||
System.print(bytes.iteratorValue(6)) // expect: 224
|
||||
System.print(bytes.iteratorValue(7)) // expect: 174
|
||||
System.print(bytes.iteratorValue(8)) // expect: 131
|
||||
|
||||
IO.print(bytes.iteratorValue(-9)) // expect: 115
|
||||
IO.print(bytes.iteratorValue(-8)) // expect: 195
|
||||
IO.print(bytes.iteratorValue(-7)) // expect: 184
|
||||
IO.print(bytes.iteratorValue(-6)) // expect: 109
|
||||
IO.print(bytes.iteratorValue(-5)) // expect: 195
|
||||
IO.print(bytes.iteratorValue(-4)) // expect: 169
|
||||
IO.print(bytes.iteratorValue(-3)) // expect: 224
|
||||
IO.print(bytes.iteratorValue(-2)) // expect: 174
|
||||
IO.print(bytes.iteratorValue(-1)) // expect: 131
|
||||
System.print(bytes.iteratorValue(-9)) // expect: 115
|
||||
System.print(bytes.iteratorValue(-8)) // expect: 195
|
||||
System.print(bytes.iteratorValue(-7)) // expect: 184
|
||||
System.print(bytes.iteratorValue(-6)) // expect: 109
|
||||
System.print(bytes.iteratorValue(-5)) // expect: 195
|
||||
System.print(bytes.iteratorValue(-4)) // expect: 169
|
||||
System.print(bytes.iteratorValue(-3)) // expect: 224
|
||||
System.print(bytes.iteratorValue(-2)) // expect: 174
|
||||
System.print(bytes.iteratorValue(-1)) // expect: 131
|
||||
|
||||
@ -3,22 +3,22 @@
|
||||
// Chars: sø mé ஃ
|
||||
var bytes = "søméஃ".bytes
|
||||
|
||||
IO.print(bytes[0]) // expect: 115
|
||||
IO.print(bytes[1]) // expect: 195
|
||||
IO.print(bytes[2]) // expect: 184
|
||||
IO.print(bytes[3]) // expect: 109
|
||||
IO.print(bytes[4]) // expect: 195
|
||||
IO.print(bytes[5]) // expect: 169
|
||||
IO.print(bytes[6]) // expect: 224
|
||||
IO.print(bytes[7]) // expect: 174
|
||||
IO.print(bytes[8]) // expect: 131
|
||||
System.print(bytes[0]) // expect: 115
|
||||
System.print(bytes[1]) // expect: 195
|
||||
System.print(bytes[2]) // expect: 184
|
||||
System.print(bytes[3]) // expect: 109
|
||||
System.print(bytes[4]) // expect: 195
|
||||
System.print(bytes[5]) // expect: 169
|
||||
System.print(bytes[6]) // expect: 224
|
||||
System.print(bytes[7]) // expect: 174
|
||||
System.print(bytes[8]) // expect: 131
|
||||
|
||||
IO.print(bytes[-9]) // expect: 115
|
||||
IO.print(bytes[-8]) // expect: 195
|
||||
IO.print(bytes[-7]) // expect: 184
|
||||
IO.print(bytes[-6]) // expect: 109
|
||||
IO.print(bytes[-5]) // expect: 195
|
||||
IO.print(bytes[-4]) // expect: 169
|
||||
IO.print(bytes[-3]) // expect: 224
|
||||
IO.print(bytes[-2]) // expect: 174
|
||||
IO.print(bytes[-1]) // expect: 131
|
||||
System.print(bytes[-9]) // expect: 115
|
||||
System.print(bytes[-8]) // expect: 195
|
||||
System.print(bytes[-7]) // expect: 184
|
||||
System.print(bytes[-6]) // expect: 109
|
||||
System.print(bytes[-5]) // expect: 195
|
||||
System.print(bytes[-4]) // expect: 169
|
||||
System.print(bytes[-3]) // expect: 224
|
||||
System.print(bytes[-2]) // expect: 174
|
||||
System.print(bytes[-1]) // expect: 131
|
||||
|
||||
Reference in New Issue
Block a user