summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorljfa-ag <ljfa-ag@web.de>2015-08-06 13:34:32 +0200
committerljfa-ag <ljfa-ag@web.de>2015-08-06 13:34:32 +0200
commit8565a07570ccd38209dd593c1116e917cd7c7230 (patch)
tree0e6cb741fc86bfa916b944b46bae3b0c594c0662
parente9dd438bd78b10c56e47479db7c7b3e2a3e9ab3a (diff)
downloadProject-Tick-8565a07570ccd38209dd593c1116e917cd7c7230.tar.gz
Project-Tick-8565a07570ccd38209dd593c1116e917cd7c7230.zip
Add test for EOF within key
-rw-r--r--test/CMakeLists.txt3
-rw-r--r--test/io/errortest_eof2bin0 -> 94 bytes
-rw-r--r--test/io/read_test.cpp7
3 files changed, 9 insertions, 1 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 63e6f20ed7..c24b7b7c23 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -14,5 +14,6 @@ add_executable(read_test io/read_test.cpp)
target_link_libraries(read_test nbt++)
add_custom_command(TARGET read_test POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/io/bigtest_uncompr ${CMAKE_CURRENT_BINARY_DIR}
- COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/io/errortest_eof1 ${CMAKE_CURRENT_BINARY_DIR})
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/io/errortest_eof1 ${CMAKE_CURRENT_BINARY_DIR}
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/io/errortest_eof2 ${CMAKE_CURRENT_BINARY_DIR})
add_test(read_test read_test)
diff --git a/test/io/errortest_eof2 b/test/io/errortest_eof2
new file mode 100644
index 0000000000..1e9a503484
--- /dev/null
+++ b/test/io/errortest_eof2
Binary files differ
diff --git a/test/io/read_test.cpp b/test/io/read_test.cpp
index d13402c2ea..ab1a46cc97 100644
--- a/test/io/read_test.cpp
+++ b/test/io/read_test.cpp
@@ -153,6 +153,13 @@ void test_read_errors()
ASSERT(file);
EXPECT_EXCEPTION(reader.read_tag(), io::input_error);
ASSERT(!file);
+
+ //EOF within a key in a compound
+ file.close();
+ file.open("errortest_eof2", std::ios::binary);
+ ASSERT(file);
+ EXPECT_EXCEPTION(reader.read_tag(), io::input_error);
+ ASSERT(!file);
}
int main()