From 94331a355d5fc2032810af7160504addcf86f783 Mon Sep 17 00:00:00 2001 From: Niels Date: Sun, 21 Aug 2016 21:50:13 +0200 Subject: [PATCH 1/2] removed LCOV_EXCL_LINE --- src/json.hpp | 22 +++++++++++----------- src/json.hpp.re2c | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/json.hpp b/src/json.hpp index a8289a49..b5e24206 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -7734,7 +7734,7 @@ class basic_json }; if ((m_limit - m_cursor) < 5) { - yyfill(); // LCOV_EXCL_LINE; + yyfill(); } yych = *m_cursor; if (yybm[0 + yych] & 32) @@ -7868,7 +7868,7 @@ basic_json_parser_6: ++m_cursor; if (m_limit <= m_cursor) { - yyfill(); // LCOV_EXCL_LINE; + yyfill(); } yych = *m_cursor; if (yybm[0 + yych] & 32) @@ -7938,7 +7938,7 @@ basic_json_parser_15: m_marker = ++m_cursor; if ((m_limit - m_cursor) < 3) { - yyfill(); // LCOV_EXCL_LINE; + yyfill(); } yych = *m_cursor; if (yybm[0 + yych] & 64) @@ -8031,7 +8031,7 @@ basic_json_parser_31: ++m_cursor; if (m_limit <= m_cursor) { - yyfill(); // LCOV_EXCL_LINE; + yyfill(); } yych = *m_cursor; basic_json_parser_32: @@ -8068,7 +8068,7 @@ basic_json_parser_36: ++m_cursor; if (m_limit <= m_cursor) { - yyfill(); // LCOV_EXCL_LINE; + yyfill(); } yych = *m_cursor; if (yych <= 'e') @@ -8212,7 +8212,7 @@ basic_json_parser_43: ++m_cursor; if (m_limit <= m_cursor) { - yyfill(); // LCOV_EXCL_LINE; + yyfill(); } yych = *m_cursor; if (yych <= '@') @@ -8248,7 +8248,7 @@ basic_json_parser_44: m_marker = ++m_cursor; if ((m_limit - m_cursor) < 3) { - yyfill(); // LCOV_EXCL_LINE; + yyfill(); } yych = *m_cursor; if (yych <= 'D') @@ -8289,7 +8289,7 @@ basic_json_parser_47: ++m_cursor; if (m_limit <= m_cursor) { - yyfill(); // LCOV_EXCL_LINE; + yyfill(); } yych = *m_cursor; if (yych <= '/') @@ -8331,7 +8331,7 @@ basic_json_parser_54: ++m_cursor; if (m_limit <= m_cursor) { - yyfill(); // LCOV_EXCL_LINE; + yyfill(); } yych = *m_cursor; if (yych <= '@') @@ -8385,7 +8385,7 @@ basic_json_parser_60: ++m_cursor; if (m_limit <= m_cursor) { - yyfill(); // LCOV_EXCL_LINE; + yyfill(); } yych = *m_cursor; if (yych <= '@') @@ -8426,7 +8426,7 @@ basic_json_parser_63: ++m_cursor; if (m_limit <= m_cursor) { - yyfill(); // LCOV_EXCL_LINE; + yyfill(); } yych = *m_cursor; if (yych <= '@') diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c index ffa20f39..fdc00638 100644 --- a/src/json.hpp.re2c +++ b/src/json.hpp.re2c @@ -7698,7 +7698,7 @@ class basic_json re2c:define:YYCURSOR = m_cursor; re2c:define:YYLIMIT = m_limit; re2c:define:YYMARKER = m_marker; - re2c:define:YYFILL = "yyfill(); // LCOV_EXCL_LINE"; + re2c:define:YYFILL = "yyfill()"; re2c:yyfill:parameter = 0; re2c:indent:string = " "; re2c:indent:top = 1; From 1e896eb91ef940cda23a4bb49a302ed227c442d7 Mon Sep 17 00:00:00 2001 From: Niels Date: Sun, 21 Aug 2016 22:38:56 +0200 Subject: [PATCH 2/2] improved code coverage --- test/src/unit-class_parser.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/src/unit-class_parser.cpp b/test/src/unit-class_parser.cpp index fe005503..259daf84 100644 --- a/test/src/unit-class_parser.cpp +++ b/test/src/unit-class_parser.cpp @@ -445,6 +445,10 @@ TEST_CASE("parser class") CHECK_THROWS_AS(json::parser("\"\\u0\"").parse(), std::invalid_argument); CHECK_THROWS_AS(json::parser("\"\\u01\"").parse(), std::invalid_argument); CHECK_THROWS_AS(json::parser("\"\\u012\"").parse(), std::invalid_argument); + CHECK_THROWS_AS(json::parser("\"\\u").parse(), std::invalid_argument); + CHECK_THROWS_AS(json::parser("\"\\u0").parse(), std::invalid_argument); + CHECK_THROWS_AS(json::parser("\"\\u01").parse(), std::invalid_argument); + CHECK_THROWS_AS(json::parser("\"\\u012").parse(), std::invalid_argument); CHECK_THROWS_WITH(json::parser("\"").parse(), "parse error - unexpected '\"'"); CHECK_THROWS_WITH(json::parser("\"\\\"").parse(), @@ -457,6 +461,14 @@ TEST_CASE("parser class") "parse error - unexpected '\"'"); CHECK_THROWS_WITH(json::parser("\"\\u012\"").parse(), "parse error - unexpected '\"'"); + CHECK_THROWS_WITH(json::parser("\"\\u").parse(), + "parse error - unexpected '\"'"); + CHECK_THROWS_WITH(json::parser("\"\\u0").parse(), + "parse error - unexpected '\"'"); + CHECK_THROWS_WITH(json::parser("\"\\u01").parse(), + "parse error - unexpected '\"'"); + CHECK_THROWS_WITH(json::parser("\"\\u012").parse(), + "parse error - unexpected '\"'"); // invalid escapes for (int c = 1; c < 128; ++c)