mirror of
https://github.com/red0124/ssp.git
synced 2025-12-14 21:59:55 +01:00
Add extended tests with no new line at eof
This commit is contained in:
@@ -12,7 +12,7 @@ using string_range = std::pair<const char*, const char*>;
|
||||
using split_data = std::vector<string_range>;
|
||||
|
||||
constexpr inline auto default_delimiter = ",";
|
||||
constexpr static auto get_line_initial_buffer_size = 128;
|
||||
constexpr inline auto get_line_initial_buffer_size = 128;
|
||||
|
||||
template <bool StringError>
|
||||
inline void assert_string_error_defined() {
|
||||
@@ -31,7 +31,7 @@ inline ssize_t get_line_file(char** lineptr, size_t* n, FILE* stream) {
|
||||
return getline(lineptr, n, stream);
|
||||
}
|
||||
#else
|
||||
// TODO set ERRNO ?
|
||||
|
||||
using ssize_t = int64_t;
|
||||
inline ssize_t get_line_file(char** lineptr, size_t* n, FILE* stream) {
|
||||
size_t pos;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "exception.hpp"
|
||||
#include "extract.hpp"
|
||||
#include "restrictions.hpp"
|
||||
#include <cerrno>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <optional>
|
||||
@@ -742,7 +743,6 @@ private:
|
||||
reader(const reader& other) = delete;
|
||||
reader& operator=(const reader& other) = delete;
|
||||
|
||||
// TODO set error numbers on error
|
||||
ssize_t get_line_buffer(char** lineptr, size_t* n,
|
||||
const char* const buffer, size_t csv_data_size,
|
||||
size_t& curr_char) {
|
||||
@@ -812,6 +812,9 @@ private:
|
||||
}
|
||||
|
||||
if (ssize == -1) {
|
||||
if (errno == ENOMEM) {
|
||||
throw std::bad_alloc{};
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user