Skip to content

Infrastructure for extracting syntax tests. #3707

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 13, 2018
Merged

Conversation

ekpyron
Copy link
Member

@ekpyron ekpyron commented Mar 12, 2018

Refs #3644.

Copies some example test contracts from SolidityNameAndTypeResolution.cpp in separate files in test/libsolidity/syntaxTests/ in which the test expectations are encoded in comments, adds a parser for this encoding and populates the boost test tree with these tests.

Part 1 of #3674.

@ekpyron
Copy link
Member Author

ekpyron commented Mar 12, 2018

Still to be discussed:

  • better alternative for the command line option --testpath ./test for soltest.

@ekpyron ekpyron requested a review from erak March 12, 2018 13:48
@ekpyron ekpyron force-pushed the syntaxTestsTestRunner branch 2 times, most recently from cfb1fc3 to 72b815d Compare March 12, 2018 16:30
@ekpyron ekpyron force-pushed the syntaxTestsTestRunner branch from 72b815d to 3232561 Compare March 13, 2018 10:20
m_errorList = parseAnalyseAndReturnError(m_source, true, true, true).second;
if (!matchesExpectations(m_errorList))
{
std::string nextIndentLevel = _indent.empty() ? "\t" : _indent + _indent;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you double the indentation instead of just adding a \t?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the interactive tool isoltest later I use two spaces instead of tabs as indentation - that was the reason, but I agree: doubling the indentation does not really make sense in any case, since passing the indent as argument suggests that it could already be deeper than one level; I'll change it to just add a tab here and think about how to do things in isoltest later.

{
ifstream file(_filename);
if (!file)
BOOST_THROW_EXCEPTION(runtime_error("cannot open test contract: \"" + _filename + "\""));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capitalize cannot?

else
for (size_t i = 0; i < _errorList.size(); i++)
if (
!(_errorList[i]->typeName() == m_expectations[i].type) ||
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say != is easier to read than !( ... == ...)

@ekpyron
Copy link
Member Author

ekpyron commented Mar 13, 2018

@chriseth Requested changes are ready.

@chriseth chriseth merged commit 6bab7a4 into develop Mar 13, 2018
@axic axic deleted the syntaxTestsTestRunner branch March 13, 2018 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants