summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/read_test.cpp15
-rw-r--r--test/testfiles/toplevel_stringbin0 -> 165 bytes
2 files changed, 15 insertions, 0 deletions
diff --git a/test/read_test.cpp b/test/read_test.cpp
index a45d74b1f6..291bf35309 100644
--- a/test/read_test.cpp
+++ b/test/read_test.cpp
@@ -176,10 +176,25 @@ void test_read_errors()
ASSERT(!file);
}
+void test_read_misc()
+{
+ std::ifstream file;
+ nbt::io::stream_reader reader(file);
+
+ file.open("toplevel_string", std::ios::binary);
+ ASSERT(file);
+ auto pair = reader.read_tag();
+ ASSERT(pair.first == "Test (toplevel tag_string)");
+ ASSERT(*pair.second == tag_string(
+ "Even though unprovided for by NBT, the library should also handle "
+ "the case where the file consists of something else than tag_compound"));
+}
+
int main()
{
test_stream_reader_big();
test_stream_reader_little();
test_read_bigtest();
test_read_errors();
+ test_read_misc();
}
diff --git a/test/testfiles/toplevel_string b/test/testfiles/toplevel_string
new file mode 100644
index 0000000000..996cc78d0b
--- /dev/null
+++ b/test/testfiles/toplevel_string
Binary files differ