| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
- reader-set-error: |
| 43 |
name: Set reader error |
| 44 |
args: [test problem, 10, 0x1234] |
| 45 |
want: false |
| 46 |
test: |
| 47 |
- eq: [ErrorType, READER_ERROR] |
| 48 |
- eq: [Problem, test problem] |
| 49 |
- eq: [ProblemOffset, 10] |
| 50 |
- eq: [ProblemValue, 0x1234] |
| 51 |
|
| 52 |
|
| 53 |
- reader-determine-encoding: |
| 54 |
name: Determine encoding UTF-8 with BOM |
| 55 |
data: [0xEF, 0xBB, 0xBF, 0x74, 0x65, 0x73, 0x74] |
| 56 |
test: |
| 57 |
- eq: [encoding, UTF8_ENCODING] |
| 58 |
- eq: [raw_buffer_pos, 3] |
| 59 |
|
| 60 |
- reader-determine-encoding: |
| 61 |
name: Determine encoding UTF-16LE |
| 62 |
data: [0xFF, 0xFE, 0x74, 0x65, 0x73, 0x74] |
| 63 |
test: |
| 64 |
- eq: [encoding, UTF16LE_ENCODING] |
| 65 |
|
| 66 |
- reader-determine-encoding: |
| 67 |
name: Determine encoding UTF-16BE |
| 68 |
data: [0xFE, 0xFF, 0x74, 0x65, 0x73, 0x74] |
| 69 |
test: |
| 70 |
- eq: [encoding, UTF16BE_ENCODING] |
| 71 |
|
| 72 |
- reader-determine-encoding: |
| 73 |
name: Determine encoding default UTF-8 |
| 74 |
data: 'test: value' |
| 75 |
test: |
| 76 |
- eq: [encoding, UTF8_ENCODING] |
| 77 |
|
| 78 |
|
| 79 |
- reader-update-raw-buffer: |
| 80 |
name: Update raw buffer with data |
| 81 |
data: test data |
| 82 |
test: |
| 83 |
- len-gt: [raw_buffer, 0] |
| 84 |
|
| 85 |
- reader-update-raw-buffer: |
| 86 |
name: Update raw buffer at EOF |
| 87 |
data: '' |
| 88 |
|
| 89 |
- reader-update-raw-buffer: |
| 90 |
name: Update raw buffer when already EOF |
| 91 |
data: '' |
| 92 |
init: |
| 93 |
eof: true |
| 94 |
|
| 95 |
|
| 96 |
- reader-update-buffer: |
| 97 |
name: Update buffer single byte UTF-8 |
| 98 |
data: abc |
| 99 |
args: 3 |
| 100 |
test: |
| 101 |
- gte: [unread, 3] |
| 102 |
- eq: [buffer-0, 0x61] |
| 103 |
- eq: [buffer-1, 0x62] |
| 104 |
- eq: [buffer-2, 0x63] |
| 105 |
|
| 106 |
- reader-update-buffer: |
| 107 |
name: Update buffer multi-byte UTF-8 |
| 108 |
data: [0x61, 0xC2, 0xA9, 0x62] |
| 109 |
args: 3 |
| 110 |
test: |
| 111 |
- gte: [unread, 3] |
| 112 |
|
| 113 |
- reader-update-buffer: |
| 114 |
name: Update buffer control character error |
| 115 |
data: [0x01] |
| 116 |
args: 1 |
| 117 |
want: false |
| 118 |
test: |
| 119 |
- eq: [ErrorType, READER_ERROR] |
| 120 |
|
| 121 |
- reader-update-buffer: |
| 122 |
name: Update buffer allowed control characters |
| 123 |
data: [0x09, 0x0A, 0x0D] |
| 124 |
args: 3 |
| 125 |
|
| 126 |
- reader-update-buffer: |
| 127 |
name: Update buffer UTF-16LE |
| 128 |
data: [0xFF, 0xFE, 0x61, 0x00] |
| 129 |
args: 1 |
| 130 |
test: |
| 131 |
- eq: [encoding, UTF16LE_ENCODING] |
| 132 |
|
| 133 |
- reader-update-buffer: |
| 134 |
name: Update buffer UTF-16BE |
| 135 |
data: [0xFE, 0xFF, 0x00, 0x61] |
| 136 |
args: 1 |
| 137 |
test: |
| 138 |
- eq: [encoding, UTF16BE_ENCODING] |
| 139 |
|
| 140 |
- reader-update-buffer: |
| 141 |
name: Update buffer surrogate pair UTF-16 |
| 142 |
data: [0xFF, 0xFE, 0x3D, 0xD8, 0x4A, 0xDC] |
| 143 |
args: 1 |
| 144 |
test: |
| 145 |
- gte: [unread, 1] |
| 146 |
|
| 147 |
- reader-update-buffer: |
| 148 |
name: Update buffer invalid surrogate pair |
| 149 |
data: [0xFF, 0xFE, 0x3D, 0xD8, 0x00, 0x00] |
| 150 |
args: 1 |
| 151 |
want: false |
| 152 |
test: |
| 153 |
- eq: [ErrorType, READER_ERROR] |
| 154 |
|
| 155 |
- reader-update-buffer: |
| 156 |
name: Update buffer unexpected low surrogate |
| 157 |
data: [0xFF, 0xFE, 0x00, 0xDC, 0x00, 0x00] |
| 158 |
args: 1 |
| 159 |
want: false |
| 160 |
test: |
| 161 |
- eq: [ErrorType, READER_ERROR] |
| 162 |
|
| 163 |
|
| 164 |
- reader-panic: |
| 165 |
name: Update buffer without read handler |
| 166 |
func: updateBuffer |
| 167 |
args: 1 |
| 168 |
want: read handler must be set |