diff --git a/spec/runtime/helpers/spy_reader.cc b/spec/runtime/helpers/spy_reader.cc index 194be372..927f3ac2 100644 --- a/spec/runtime/helpers/spy_reader.cc +++ b/spec/runtime/helpers/spy_reader.cc @@ -8,7 +8,7 @@ static const char * spy_read(void *data, size_t *bytes_read) { size_t size = std::min(reader->chunk_size, reader->content.length() - reader->position); const char *result = reader->content.data() + reader->position; - reader->chunks_read.push_back(string(result, size)); + reader->strings_read.back() += string(result, size); reader->position += size; *bytes_read = size; return result; @@ -16,6 +16,7 @@ static const char * spy_read(void *data, size_t *bytes_read) { static int spy_seek(void *data, size_t position) { SpyReader *reader = static_cast(data); + reader->strings_read.push_back(""); reader->position = position; return 0; } diff --git a/spec/runtime/helpers/spy_reader.h b/spec/runtime/helpers/spy_reader.h index 457d5898..1ad90d39 100644 --- a/spec/runtime/helpers/spy_reader.h +++ b/spec/runtime/helpers/spy_reader.h @@ -13,7 +13,7 @@ public: size_t position; size_t chunk_size; ts_input input; - std::vector chunks_read; + std::vector strings_read; }; #endif // HELPERS_SPY_READER_H_ diff --git a/spec/runtime/parser_spec.cc b/spec/runtime/parser_spec.cc index 2ede7b60..33c0e340 100644 --- a/spec/runtime/parser_spec.cc +++ b/spec/runtime/parser_spec.cc @@ -33,12 +33,8 @@ describe("parsing", [&]() { }); it("reads the entire input", [&]() { - AssertThat(reader->chunks_read, Equals(vector({ - "{ \"ke", - "y\": [", - "1, 2]", - " }", - "" + AssertThat(reader->strings_read, Equals(vector({ + "{ \"key\": [1, 2] }" }))); });