diff options
Diffstat (limited to 'test')
8 files changed, 48 insertions, 2 deletions
diff --git a/test/boostTest.cpp b/test/boostTest.cpp index 145be6e4..6c68100c 100644 --- a/test/boostTest.cpp +++ b/test/boostTest.cpp @@ -28,7 +28,7 @@ #pragma warning(push) #pragma warning(disable:4535) // calling _set_se_translator requires /EHa #endif -#include <boost/test/included/unit_test.hpp> +#include <boost/test/unit_test.hpp> #if defined(_MSC_VER) #pragma warning(pop) #endif diff --git a/test/libsolidity/syntaxTests/indexing/array_out_of_bounds_index.sol b/test/libsolidity/syntaxTests/indexing/array_out_of_bounds_index.sol new file mode 100644 index 00000000..b0079857 --- /dev/null +++ b/test/libsolidity/syntaxTests/indexing/array_out_of_bounds_index.sol @@ -0,0 +1,8 @@ +contract C { + function f() public { + bytes[32] memory a; + a[64]; + } +} +// ---- +// TypeError: (65-70): Out of bounds array access. diff --git a/test/libsolidity/syntaxTests/indexing/array_without_index.sol b/test/libsolidity/syntaxTests/indexing/array_without_index.sol new file mode 100644 index 00000000..6b1c2778 --- /dev/null +++ b/test/libsolidity/syntaxTests/indexing/array_without_index.sol @@ -0,0 +1,8 @@ +contract C { + function f() public { + bytes memory a; + a[]; + } +} +// ---- +// TypeError: (61-64): Index expression cannot be omitted. diff --git a/test/libsolidity/syntaxTests/indexing/fixedbytes_out_of_bounds_index.sol b/test/libsolidity/syntaxTests/indexing/fixedbytes_out_of_bounds_index.sol new file mode 100644 index 00000000..8264a8b2 --- /dev/null +++ b/test/libsolidity/syntaxTests/indexing/fixedbytes_out_of_bounds_index.sol @@ -0,0 +1,8 @@ +contract C { + function f() public { + bytes32 b; + b[64]; + } +} +// ---- +// TypeError: (56-61): Out of bounds array access. diff --git a/test/libsolidity/syntaxTests/indexing/fixedbytes_without_index.sol b/test/libsolidity/syntaxTests/indexing/fixedbytes_without_index.sol new file mode 100644 index 00000000..979ac8a7 --- /dev/null +++ b/test/libsolidity/syntaxTests/indexing/fixedbytes_without_index.sol @@ -0,0 +1,8 @@ +contract C { + function f() public { + bytes32 b; + b[]; + } +} +// ---- +// TypeError: (56-59): Index expression cannot be omitted. diff --git a/test/libsolidity/syntaxTests/indexing/function_type.sol b/test/libsolidity/syntaxTests/indexing/function_type.sol new file mode 100644 index 00000000..6c6c06a9 --- /dev/null +++ b/test/libsolidity/syntaxTests/indexing/function_type.sol @@ -0,0 +1,7 @@ +contract C { + function f() public { + f[0]; + } +} +// ---- +// TypeError: (41-42): Indexed expression has to be a type, mapping or array (is function ()) diff --git a/test/libsolidity/syntaxTests/indexing/function_type_without_index.sol b/test/libsolidity/syntaxTests/indexing/function_type_without_index.sol new file mode 100644 index 00000000..bf511bc9 --- /dev/null +++ b/test/libsolidity/syntaxTests/indexing/function_type_without_index.sol @@ -0,0 +1,7 @@ +contract C { + function f() public { + f[]; + } +} +// ---- +// TypeError: (41-42): Indexed expression has to be a type, mapping or array (is function ()) diff --git a/test/tools/isoltest.cpp b/test/tools/isoltest.cpp index ed4f148e..bd4b0db9 100644 --- a/test/tools/isoltest.cpp +++ b/test/tools/isoltest.cpp @@ -119,7 +119,7 @@ TestTool::Result TestTool::process() "Exception during syntax test: " << _e.what() << endl; return Result::Exception; } - catch(...) + catch (...) { FormattedScope(cout, m_formatted, {BOLD, RED}) << "Unknown exception during syntax test." << endl; |