summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorljfa-ag <ljfa-ag@web.de>2015-08-06 13:47:22 +0200
committerljfa-ag <ljfa-ag@web.de>2015-08-06 13:47:22 +0200
commit16a9df1556afc1650bbc883303ab0ee283710ce9 (patch)
treeb1006f534b3a4412dbfcb96377e6d2d85d5fb4a2 /test
parent8565a07570ccd38209dd593c1116e917cd7c7230 (diff)
downloadProject-Tick-16a9df1556afc1650bbc883303ab0ee283710ce9.tar.gz
Project-Tick-16a9df1556afc1650bbc883303ab0ee283710ce9.zip
Add test for missing tag_end
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt3
-rw-r--r--test/io/errortest_noendbin0 -> 48 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 c24b7b7c23..cffce2ad7b 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -15,5 +15,6 @@ 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_eof2 ${CMAKE_CURRENT_BINARY_DIR})
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/io/errortest_eof2 ${CMAKE_CURRENT_BINARY_DIR}
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/io/errortest_noend ${CMAKE_CURRENT_BINARY_DIR})
add_test(read_test read_test)
diff --git a/test/io/errortest_noend b/test/io/errortest_noend
new file mode 100644
index 0000000000..d90614628c
--- /dev/null
+++ b/test/io/errortest_noend
Binary files differ
diff --git a/test/io/read_test.cpp b/test/io/read_test.cpp
index ab1a46cc97..85970fc069 100644
--- a/test/io/read_test.cpp
+++ b/test/io/read_test.cpp
@@ -160,6 +160,13 @@ void test_read_errors()
ASSERT(file);
EXPECT_EXCEPTION(reader.read_tag(), io::input_error);
ASSERT(!file);
+
+ //Missing tag_end
+ file.close();
+ file.open("errortest_noend", std::ios::binary);
+ ASSERT(file);
+ EXPECT_EXCEPTION(reader.read_tag(), io::input_error);
+ ASSERT(!file);
}
int main()