ReadNextDocument reads lines until it encounters "---" or EOF (YAML), or reads one line for NDJSON (JSON format).
()
| 81 | // ReadNextDocument reads lines until it encounters "---" or EOF (YAML), |
| 82 | // or reads one line for NDJSON (JSON format). |
| 83 | func (r *MockReader) ReadNextDocument() ([]byte, error) { |
| 84 | if r.done { |
| 85 | return nil, io.EOF |
| 86 | } |
| 87 | |
| 88 | if r.format == FormatJSON { |
| 89 | return r.readNextJSONLine() |
| 90 | } |
| 91 | return r.readNextYAMLDocument() |
| 92 | } |
| 93 | |
| 94 | func (r *MockReader) readNextJSONLine() ([]byte, error) { |
| 95 | for { |
no test coverage detected