diff options
author | Lefteris Karapetsas <lefteris@refu.co> | 2015-01-20 20:15:43 +0800 |
---|---|---|
committer | Lefteris Karapetsas <lefteris@refu.co> | 2015-01-20 20:15:43 +0800 |
commit | 8b29bdaf1067d757a253f5e3e604e1b42e28d579 (patch) | |
tree | 5adde33dffb9c225aa84a1e7f2f4531dba857788 /SolidityNatspecJSON.cpp | |
parent | 1fc3c7b4986e79908b44ecb74dc0e650bbf2bd97 (diff) | |
download | dexon-solidity-8b29bdaf1067d757a253f5e3e604e1b42e28d579.tar dexon-solidity-8b29bdaf1067d757a253f5e3e604e1b42e28d579.tar.gz dexon-solidity-8b29bdaf1067d757a253f5e3e604e1b42e28d579.tar.bz2 dexon-solidity-8b29bdaf1067d757a253f5e3e604e1b42e28d579.tar.lz dexon-solidity-8b29bdaf1067d757a253f5e3e604e1b42e28d579.tar.xz dexon-solidity-8b29bdaf1067d757a253f5e3e604e1b42e28d579.tar.zst dexon-solidity-8b29bdaf1067d757a253f5e3e604e1b42e28d579.zip |
Absence of tag in Natspec is now considered @notice
Diffstat (limited to 'SolidityNatspecJSON.cpp')
-rw-r--r-- | SolidityNatspecJSON.cpp | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/SolidityNatspecJSON.cpp b/SolidityNatspecJSON.cpp index 5cec0444..743651d5 100644 --- a/SolidityNatspecJSON.cpp +++ b/SolidityNatspecJSON.cpp @@ -506,17 +506,35 @@ BOOST_AUTO_TEST_CASE(dev_title_at_function_error) BOOST_CHECK_THROW(checkNatspec(sourceCode, natspec, false), DocstringParsingError); } -// test for bug where having no tags in docstring would cause infinite loop -BOOST_AUTO_TEST_CASE(natspec_no_tags) +BOOST_AUTO_TEST_CASE(natspec_notice_without_tag) { char const* sourceCode = "contract test {\n" " /// I do something awesome\n" - " function mul(uint a, uint second) returns(uint d) { return a * 7 + second; }\n" + " function mul(uint a) returns(uint d) { return a * 7; }\n" "}\n"; - char const* natspec = "{\"methods\": {}}"; + char const* natspec = "{" + "\"methods\":{" + " \"mul(uint256)\":{ \"notice\": \"I do something awesome\"}" + "}}"; + + checkNatspec(sourceCode, natspec, true); +} - checkNatspec(sourceCode, natspec, false); +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* natspec = "{" + "\"methods\":{" + " \"mul(uint256)\":{ \"notice\": \"I do something awesome which requires two lines to explain\"}" + "}}"; + + checkNatspec(sourceCode, natspec, true); } BOOST_AUTO_TEST_SUITE_END() |