mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Support parsing balance in isoltest
This commit is contained in:
parent
4e86390e40
commit
e03d910e4b
@ -234,7 +234,7 @@ TestCase::TestResult SemanticTest::runTest(ostream& _stream, string const& _line
|
||||
return TestResult::Failure;
|
||||
}
|
||||
|
||||
if (!success && (m_runWithYul || !_compileViaYul))
|
||||
if (!success) // && (m_runWithYul || !_compileViaYul))
|
||||
{
|
||||
AnsiColorized(_stream, _formatted, {BOLD, CYAN}) << _linePrefix << "Expected result:" << endl;
|
||||
for (auto const& test: m_tests)
|
||||
|
@ -23,7 +23,7 @@ namespace solidity::frontend::test
|
||||
/**
|
||||
* All soltest tokens.
|
||||
*/
|
||||
#define SOLT_TOKEN_LIST(T, K) \
|
||||
#define SOLT_TOKEN_LIST(T, K) \
|
||||
T(Unknown, "unknown", 0) \
|
||||
T(Invalid, "invalid", 0) \
|
||||
T(EOS, "EOS", 0) \
|
||||
@ -57,7 +57,8 @@ namespace solidity::frontend::test
|
||||
K(Library, "library", 0) \
|
||||
K(Right, "right", 0) \
|
||||
K(Failure, "FAILURE", 0) \
|
||||
K(Storage, "storage", 0) \
|
||||
K(Storage, "storage", 0) \
|
||||
K(Balance, "balance", 0)
|
||||
|
||||
namespace soltest
|
||||
{
|
||||
@ -286,7 +287,9 @@ struct FunctionCall
|
||||
/// Marks a library deployment call.
|
||||
Library,
|
||||
/// Check that the storage of the current contract is empty or non-empty.
|
||||
Storage
|
||||
Storage,
|
||||
/// Check balance of current contract.
|
||||
Balance
|
||||
};
|
||||
Kind kind = Kind::Regular;
|
||||
/// Marks this function call as "short-handed", meaning
|
||||
|
@ -100,6 +100,21 @@ vector<solidity::frontend::test::FunctionCall> TestFileParser::parseFunctionCall
|
||||
call.kind = FunctionCall::Kind::Storage;
|
||||
m_scanner.scanNextToken();
|
||||
}
|
||||
else if (accept(Token::Balance, true))
|
||||
{
|
||||
// Address is specified
|
||||
if (accept(Token::HexNumber, true))
|
||||
{
|
||||
}
|
||||
// expect(Token::Colon);
|
||||
expect(Token::Arrow);
|
||||
call.expectations.failure = false;
|
||||
call.expectations.result.push_back(Parameter());
|
||||
// expectation encoded as value
|
||||
call.value = parseFunctionCallValue();
|
||||
call.kind = FunctionCall::Kind::Balance;
|
||||
m_scanner.scanNextToken();
|
||||
}
|
||||
else
|
||||
{
|
||||
bool lowLevelCall = false;
|
||||
@ -498,6 +513,7 @@ void TestFileParser::Scanner::scanNextToken()
|
||||
if (_literal == "hex") return {Token::Hex, ""};
|
||||
if (_literal == "FAILURE") return {Token::Failure, ""};
|
||||
if (_literal == "storage") return {Token::Storage, ""};
|
||||
if (_literal == "balance") return {Token::Balance, ""};
|
||||
return {Token::Identifier, _literal};
|
||||
};
|
||||
|
||||
|
@ -74,6 +74,10 @@ string TestFunctionCall::format(
|
||||
|
||||
return;
|
||||
}
|
||||
else if (m_call.kind == FunctionCall::Kind::Balance)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// Formats the function signature. This is the same independent from the display-mode.
|
||||
stream << _linePrefix << newline << ws << m_call.signature;
|
||||
|
Loading…
Reference in New Issue
Block a user