]> granicus.if.org Git - graphviz/commitdiff
add test of Agraph construction throwing an exception for empty DOT source
authorMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Fri, 16 Jul 2021 04:30:50 +0000 (06:30 +0200)
committerMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Sat, 7 Aug 2021 04:54:12 +0000 (06:54 +0200)
Towards https://gitlab.com/graphviz/graphviz/-/issues/2001.

tests/test_AGraph_construction.cpp

index 7504b4d730dbc39bfa3db1e002bb8173685b8d56..33898884eb8fc038ba82238c439be1e2a1e343f0 100644 (file)
@@ -10,6 +10,10 @@ TEST_CASE("AGraph can be constructed from DOT source and has an underlying C "
   REQUIRE(g.c_struct() != nullptr);
 }
 
+TEST_CASE("AGraph constructed from an empty string throws an exception") {
+  REQUIRE_THROWS_AS(CGraph::AGraph(""), std::runtime_error);
+}
+
 TEST_CASE("AGraph constructed from bad DOT source throws an exception") {
   REQUIRE_THROWS_AS(CGraph::AGraph("THIS_SHOULD_GENERATE_A_SYNTAX_ERROR"),
                     std::runtime_error);