1
0
forked from Mirror/wren

Move codePointAt() to separate CodePointSequence class.

This commit is contained in:
Bob Nystrom
2015-09-11 07:56:01 -07:00
parent bda9ad880a
commit c0b5ec9f15
30 changed files with 202 additions and 76 deletions

View File

@ -2,8 +2,8 @@ var s = "abçd"
IO.print(s.iteratorValue(0)) // expect: a
IO.print(s.iteratorValue(1)) // expect: b
IO.print(s.iteratorValue(2)) // expect: ç
// Iterator value in middle of UTF sequence is an empty string.
IO.print(s.iteratorValue(3) == "") // expect: true
// Iterator value in middle of UTF sequence is the unencoded byte.
IO.print(s.iteratorValue(3) == "\xa7") // expect: true
IO.print(s.iteratorValue(4)) // expect: d
// 8-bit clean.
@ -13,3 +13,7 @@ IO.print(t.iteratorValue(1) == "\0") // expect: true
IO.print(t.iteratorValue(2) == "b") // expect: true
IO.print(t.iteratorValue(3) == "\0") // expect: true
IO.print(t.iteratorValue(4) == "c") // expect: true
// Returns single byte strings for invalid UTF-8 sequences.
IO.print("\xef\xf7".iteratorValue(0) == "\xef") // expect: true
IO.print("\xef\xf7".iteratorValue(1) == "\xf7") // expect: true