From 3d7e6d8adf4901c89fc452934283a15b8c86b11c Mon Sep 17 00:00:00 2001 From: Liana Husikyan Date: Thu, 18 Jun 2015 14:57:43 +0200 Subject: changedthe output style of the Natspec docstring --- libsolidity/SolidityNatspecJSON.cpp | 51 ++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 17 deletions(-) (limited to 'libsolidity') diff --git a/libsolidity/SolidityNatspecJSON.cpp b/libsolidity/SolidityNatspecJSON.cpp index e7e39a0b..2fc4f77b 100644 --- a/libsolidity/SolidityNatspecJSON.cpp +++ b/libsolidity/SolidityNatspecJSON.cpp @@ -21,6 +21,7 @@ */ #include "../TestHelper.h" +#include #include #include #include @@ -482,31 +483,47 @@ BOOST_AUTO_TEST_CASE(dev_author_at_function) BOOST_AUTO_TEST_CASE(natspec_notice_without_tag) { - char const* sourceCode = "contract test {\n" - " /// I do something awesome\n" - " function mul(uint a) returns(uint d) { return a * 7; }\n" - "}\n"; + char const* sourceCode = R"( + contract test { + /// I do something awesome + function mul(uint a) returns(uint d) { return a * 7; } + } + )"; - char const* natspec = "{" - "\"methods\":{" - " \"mul(uint256)\":{ \"notice\": \"I do something awesome\"}" - "}}"; + + char const* natspec = R"ABCDEF( + { + "methods" : { + "mul(uint256)" : { + "notice" : " I do something awesome" + } + } + } + )ABCDEF"; checkNatspec(sourceCode, natspec, true); } BOOST_AUTO_TEST_CASE(natspec_multiline_notice_without_tag) { - char const* sourceCode = "contract test {\n" - " /// I do something awesome\n" - " /// which requires two lines to explain\n" - " function mul(uint a) returns(uint d) { return a * 7; }\n" - "}\n"; + char const* sourceCode = R"( + contract test { + /// I do something awesome + /// which requires two lines to explain + function mul(uint a) returns(uint d) { return a * 7; } + } + )"; + + char const* natspec = R"ABCDEF( + { + "methods" : { + "mul(uint256)" : { + "notice" : " I do something awesome which requires two lines to explain" + } + } + } - char const* natspec = "{" - "\"methods\":{" - " \"mul(uint256)\":{ \"notice\": \"I do something awesome which requires two lines to explain\"}" - "}}"; + )ABCDEF"; checkNatspec(sourceCode, natspec, true); } -- cgit