| 1 | module chunked |
| 2 | |
| 3 | fn test_invalid_chunk() { |
| 4 | mut is_failure := false |
| 5 | |
| 6 | decode('eee') or { is_failure = true } |
| 7 | |
| 8 | assert is_failure |
| 9 | } |
| 10 | |
| 11 | fn test_valid_chunk() { |
| 12 | chunks := '4\r\nWiki\r\n7\r\npedia i\r\nB\r\nn \r\nchunks.\r\n0\r\n\r\n' |
| 13 | str := decode(chunks) or { panic('uh oh') } |
| 14 | |
| 15 | assert str == 'Wikipedia in \r\nchunks.' |
| 16 | } |
| 17 |