Experimental standard library

Change import syntax and cover with tests
This commit is contained in:
Nikola Matic
2023-06-06 17:16:23 +02:00
parent f1d2eda795
commit 47969adf91
17 changed files with 157 additions and 22 deletions
+19 -16
View File
@@ -123,25 +123,28 @@ void SyntaxTest::filterObtainedErrors()
string sourceName;
if (SourceLocation const* location = currentError->sourceLocation())
{
locationStart = location->start;
locationEnd = location->end;
solAssert(location->sourceName, "");
sourceName = *location->sourceName;
solAssert(m_sources.sources.count(sourceName) == 1, "");
int preambleSize =
static_cast<int>(compiler().charStream(sourceName).size()) -
static_cast<int>(m_sources.sources[sourceName].size());
solAssert(preambleSize >= 0, "");
// ignore the version & license pragma inserted by the testing tool when calculating locations.
if (location->start != -1)
if(m_sources.sources.count(sourceName) == 1)
{
solAssert(location->start >= preambleSize, "");
locationStart = location->start - preambleSize;
}
if (location->end != -1)
{
solAssert(location->end >= preambleSize, "");
locationEnd = location->end - preambleSize;
int preambleSize =
static_cast<int>(compiler().charStream(sourceName).size()) -
static_cast<int>(m_sources.sources[sourceName].size());
solAssert(preambleSize >= 0, "");
// ignore the version & license pragma inserted by the testing tool when calculating locations.
if (location->start != -1)
{
solAssert(location->start >= preambleSize, "");
locationStart = location->start - preambleSize;
}
if (location->end != -1)
{
solAssert(location->end >= preambleSize, "");
locationEnd = location->end - preambleSize;
}
}
}
m_errorList.emplace_back(SyntaxTestError{
@@ -0,0 +1,8 @@
pragma experimental solidity;
import std.stub;
// ====
// EVMVersion: >=constantinople
// ----
// Warning 2264: (std.stub:63-92): Experimental features are turned on. Do not use experimental features on live deployments.
// Warning 2264: (0-29): Experimental features are turned on. Do not use experimental features on live deployments.
@@ -0,0 +1,8 @@
pragma experimental solidity;
import std.stub as stub;
// ====
// EVMVersion: >=constantinople
// ----
// Warning 2264: (std.stub:63-92): Experimental features are turned on. Do not use experimental features on live deployments.
// Warning 2264: (0-29): Experimental features are turned on. Do not use experimental features on live deployments.
@@ -0,0 +1,8 @@
pragma experimental solidity;
import { identity } from std.stub;
// ====
// EVMVersion: >=constantinople
// ----
// Warning 2264: (std.stub:63-92): Experimental features are turned on. Do not use experimental features on live deployments.
// Warning 2264: (0-29): Experimental features are turned on. Do not use experimental features on live deployments.
@@ -0,0 +1,8 @@
pragma experimental solidity;
import * as stub from std.stub;
// ====
// EVMVersion: >=constantinople
// ----
// Warning 2264: (std.stub:63-92): Experimental features are turned on. Do not use experimental features on live deployments.
// Warning 2264: (0-29): Experimental features are turned on. Do not use experimental features on live deployments.
@@ -0,0 +1,3 @@
import std.stub;
// ----
// ParserError 9478: (7-10): Expected string literal (path), "*" or alias list.
@@ -0,0 +1,3 @@
import { identity } from std.stub;
// ----
// ParserError 6845: (25-28): Expected import path.