Clean up text handling a bit:
- Rename IO.write -> IO.print. - Make IO.write not print a newline. - Support \u Unicode escapes in strings.
This commit is contained in:
@@ -1,27 +1,27 @@
|
||||
var a = [1, 2, 3]
|
||||
a.removeAt(0)
|
||||
IO.write(a) // expect: [2, 3]
|
||||
IO.print(a) // expect: [2, 3]
|
||||
|
||||
var b = [1, 2, 3]
|
||||
b.removeAt(1)
|
||||
IO.write(b) // expect: [1, 3]
|
||||
IO.print(b) // expect: [1, 3]
|
||||
|
||||
var c = [1, 2, 3]
|
||||
c.removeAt(2)
|
||||
IO.write(c) // expect: [1, 2]
|
||||
IO.print(c) // expect: [1, 2]
|
||||
|
||||
// Index backwards from end.
|
||||
var d = [1, 2, 3]
|
||||
d.removeAt(-3)
|
||||
IO.write(d) // expect: [2, 3]
|
||||
IO.print(d) // expect: [2, 3]
|
||||
|
||||
var e = [1, 2, 3]
|
||||
e.removeAt(-2)
|
||||
IO.write(e) // expect: [1, 3]
|
||||
IO.print(e) // expect: [1, 3]
|
||||
|
||||
var f = [1, 2, 3]
|
||||
f.removeAt(-1)
|
||||
IO.write(f) // expect: [1, 2]
|
||||
IO.print(f) // expect: [1, 2]
|
||||
|
||||
// Return the removed value.
|
||||
IO.write([3, 4, 5].removeAt(1)) // expect: 4
|
||||
IO.print([3, 4, 5].removeAt(1)) // expect: 4
|
||||
|
||||
Reference in New Issue
Block a user