From 8e2fe9c45f69d6dc0ab9157f5198238bb0c2583e Mon Sep 17 00:00:00 2001 From: ljfa-ag Date: Thu, 6 Aug 2015 14:16:46 +0200 Subject: Add test for toplevel tags other than compound --- test/read_test.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test/read_test.cpp') 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(); } -- cgit 0.0.5-2-1-g0f52