changedthe output style of the Natspec docstring

This commit is contained in:
Liana Husikyan 2015-06-18 14:57:43 +02:00
parent 3f1042d23b
commit 3d7e6d8adf

View File

@ -21,6 +21,7 @@
*/ */
#include "../TestHelper.h" #include "../TestHelper.h"
#include <string>
#include <json/json.h> #include <json/json.h>
#include <libsolidity/CompilerStack.h> #include <libsolidity/CompilerStack.h>
#include <libsolidity/Exceptions.h> #include <libsolidity/Exceptions.h>
@ -482,31 +483,47 @@ BOOST_AUTO_TEST_CASE(dev_author_at_function)
BOOST_AUTO_TEST_CASE(natspec_notice_without_tag) BOOST_AUTO_TEST_CASE(natspec_notice_without_tag)
{ {
char const* sourceCode = "contract test {\n" char const* sourceCode = R"(
" /// I do something awesome\n" contract test {
" function mul(uint a) returns(uint d) { return a * 7; }\n" /// I do something awesome
"}\n"; function mul(uint a) returns(uint d) { return a * 7; }
}
)";
char const* natspec = "{"
"\"methods\":{" char const* natspec = R"ABCDEF(
" \"mul(uint256)\":{ \"notice\": \"I do something awesome\"}" {
"}}"; "methods" : {
"mul(uint256)" : {
"notice" : " I do something awesome"
}
}
}
)ABCDEF";
checkNatspec(sourceCode, natspec, true); checkNatspec(sourceCode, natspec, true);
} }
BOOST_AUTO_TEST_CASE(natspec_multiline_notice_without_tag) BOOST_AUTO_TEST_CASE(natspec_multiline_notice_without_tag)
{ {
char const* sourceCode = "contract test {\n" char const* sourceCode = R"(
" /// I do something awesome\n" contract test {
" /// which requires two lines to explain\n" /// I do something awesome
" function mul(uint a) returns(uint d) { return a * 7; }\n" /// which requires two lines to explain
"}\n"; function mul(uint a) returns(uint d) { return a * 7; }
}
)";
char const* natspec = "{" char const* natspec = R"ABCDEF(
"\"methods\":{" {
" \"mul(uint256)\":{ \"notice\": \"I do something awesome which requires two lines to explain\"}" "methods" : {
"}}"; "mul(uint256)" : {
"notice" : " I do something awesome which requires two lines to explain"
}
}
}
)ABCDEF";
checkNatspec(sourceCode, natspec, true); checkNatspec(sourceCode, natspec, true);
} }