Fix issue #2 on GitHub
This commit is contained in:
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@@ -43,6 +43,8 @@
|
||||
"stdexcept": "cpp",
|
||||
"streambuf": "cpp",
|
||||
"typeinfo": "cpp",
|
||||
"config.cpp.in": "cpp"
|
||||
"config.cpp.in": "cpp",
|
||||
"cinttypes": "cpp",
|
||||
"map": "cpp"
|
||||
}
|
||||
}
|
||||
@@ -217,6 +217,12 @@ template <typename number_t>
|
||||
std::vector<number_t> load_array_text(std::istream & input) {
|
||||
std::vector<number_t> result;
|
||||
for (;;) {
|
||||
skip_space(input);
|
||||
char c = cheof(input);
|
||||
input.putback(c);
|
||||
if (c == ']') {
|
||||
break;
|
||||
}
|
||||
result.push_back(load_text<number_t>(input));
|
||||
skip_space(input);
|
||||
char next = cheof(input);
|
||||
|
||||
17
test/issue2.cpp
Normal file
17
test/issue2.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#include <sstream>
|
||||
|
||||
#include "nbt.hpp"
|
||||
|
||||
#include "test.hpp"
|
||||
|
||||
using namespace nbt;
|
||||
|
||||
test {
|
||||
std::stringstream input(R"({ "voidByteArray": [B; ] })");
|
||||
tags::compound_tag root;
|
||||
input >> contexts::mojangson >> root;
|
||||
std::string key("voidByteArray");
|
||||
auto & bytes = root.get<std::vector<std::int8_t>>(key);
|
||||
assert_true(bytes.empty());
|
||||
std::cout << contexts::mojangson << root;
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
test_names = [
|
||||
'nbt'
|
||||
'nbt',
|
||||
'issue2'
|
||||
]
|
||||
|
||||
test_files = []
|
||||
|
||||
Reference in New Issue
Block a user