Apply minor changes to tests

This commit is contained in:
ado
2023-08-05 12:05:17 +02:00
parent a7ea9e42e5
commit 2b132bc33a
5 changed files with 15 additions and 9 deletions

View File

@@ -16,6 +16,7 @@
#include <cstdlib>
#endif
// TODO try from_chars for integer conversions
namespace ss {
////////////////

View File

@@ -574,7 +574,6 @@ private:
: delim_{delim}, file_{fopen(file_name_.c_str(), "rb")} {
}
// TODO test for next_line_size_
reader(reader&& other)
: buffer_{other.buffer_},
next_line_buffer_{other.next_line_buffer_},
@@ -771,12 +770,13 @@ private:
const char* const second, size_t second_size) {
// TODO make buffer_size an argument
next_line_buffer_size_ = first_size + second_size + 3;
first = static_cast<char*>(
auto new_first = static_cast<char*>(
realloc(static_cast<void*>(first), next_line_buffer_size_));
if (!first) {
// TODO restore first in order to prevent memory leak
throw std::bad_alloc{};
}
first = new_first;
std::copy_n(second, second_size + 1, first + first_size);
first_size += second_size;
}

View File

@@ -25,7 +25,6 @@ private:
constexpr static auto throw_on_error = setup<Options...>::throw_on_error;
constexpr static auto is_const_line = !quote::enabled && !escape::enabled;
// TODO make error_type none if throw_on_error
using error_type = std::conditional_t<string_error, std::string, bool>;
public:
@@ -149,7 +148,6 @@ private:
}
}
// TODO rename with handle error
void handle_error_unterminated_escape() {
constexpr static auto error_msg =
"unterminated escape at the end of the line";