mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Support multiple sources for syntax tests.
This commit is contained in:
committed by
chriseth
parent
95d426bd88
commit
6ed219ebe8
@@ -0,0 +1,10 @@
|
||||
==== Source: A ====
|
||||
contract A {
|
||||
function g() public { x; }
|
||||
}
|
||||
==== Source: B ====
|
||||
contract B {
|
||||
function f() public { }
|
||||
}
|
||||
// ----
|
||||
// DeclarationError: (A:36-37): Undeclared identifier.
|
||||
@@ -0,0 +1,12 @@
|
||||
==== Source: A ====
|
||||
contract A {
|
||||
function g(uint256 x) public view returns(uint256) { return x; }
|
||||
}
|
||||
==== Source: B ====
|
||||
import "A";
|
||||
contract B is A {
|
||||
function f(uint256 x) public view returns(uint256) { return x; }
|
||||
}
|
||||
// ----
|
||||
// Warning: (A:14-78): Function state mutability can be restricted to pure
|
||||
// Warning: (B:31-95): Function state mutability can be restricted to pure
|
||||
@@ -0,0 +1,5 @@
|
||||
==== Source: a ====
|
||||
import "b";
|
||||
contract C {}
|
||||
// ----
|
||||
// ParserError: (a:0-11): Source "b" not found: File not supplied initially.
|
||||
@@ -0,0 +1,10 @@
|
||||
==== Source: A ====
|
||||
contract A {
|
||||
function g(uint256 x) public view returns(uint256) { return x; }
|
||||
}
|
||||
==== Source: B ====
|
||||
contract B is A {
|
||||
function f(uint256 x) public view returns(uint256) { return x; }
|
||||
}
|
||||
// ----
|
||||
// DeclarationError: (B:14-15): Identifier not found or not unique.
|
||||
@@ -0,0 +1,7 @@
|
||||
==== Source: SourceName ====
|
||||
contract A {
|
||||
uint256 x;
|
||||
function f() public pure { x = 42; }
|
||||
}
|
||||
// ----
|
||||
// TypeError: (SourceName:53-54): Function declared as pure, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable.
|
||||
@@ -0,0 +1,11 @@
|
||||
==== Source: A ====
|
||||
contract A {
|
||||
function g(uint256 x) public view returns(uint256) { return x; }
|
||||
}
|
||||
==== Source: B ====
|
||||
contract B {
|
||||
function f(uint256 x) public view returns(uint256) { return x; }
|
||||
}
|
||||
// ----
|
||||
// Warning: (A:14-78): Function state mutability can be restricted to pure
|
||||
// Warning: (B:14-78): Function state mutability can be restricted to pure
|
||||
Reference in New Issue
Block a user