From a9a414bd0f6ba89bfd719ea6b6c8501861e0ece6 Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 24 Oct 2018 14:29:33 +0200 Subject: Added some tests. --- .../syntaxTests/inlineAssembly/invalid/empty_fun_arg.sol | 13 +++++++++++++ .../inlineAssembly/invalid/empty_function_name.sol | 10 ++++++++++ .../syntaxTests/inlineAssembly/invalid/invalid_number.sol | 10 ++++++++++ .../inlineAssembly/invalid/missing_variable_in_assign.sol | 11 +++++++++++ 4 files changed, 44 insertions(+) create mode 100644 test/libsolidity/syntaxTests/inlineAssembly/invalid/empty_fun_arg.sol create mode 100644 test/libsolidity/syntaxTests/inlineAssembly/invalid/empty_function_name.sol create mode 100644 test/libsolidity/syntaxTests/inlineAssembly/invalid/invalid_number.sol create mode 100644 test/libsolidity/syntaxTests/inlineAssembly/invalid/missing_variable_in_assign.sol (limited to 'test/libsolidity') diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/empty_fun_arg.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/empty_fun_arg.sol new file mode 100644 index 00000000..e05277de --- /dev/null +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/empty_fun_arg.sol @@ -0,0 +1,13 @@ +contract C { + function f() public pure { + assembly { + function f(a, b) {} + f() + f(1,) + f(,1) + } + } +} +// ---- +// ParserError: (113-114): Literal, identifier or instruction expected. +// ParserError: (113-114): Expected primary expression. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/empty_function_name.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/empty_function_name.sol new file mode 100644 index 00000000..17995b09 --- /dev/null +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/empty_function_name.sol @@ -0,0 +1,10 @@ +contract C { + function f() public pure { + assembly { + function (a, b) {} + } + } +} +// ---- +// ParserError: (72-73): Expected identifier but got '(' +// ParserError: (79-80): Expected ';' but got '{' diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/invalid_number.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/invalid_number.sol new file mode 100644 index 00000000..715913de --- /dev/null +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/invalid_number.sol @@ -0,0 +1,10 @@ +contract C { + function f() public pure { + assembly { + let x := 0100 + } + } +} +// ---- +// ParserError: (72-73): Literal, identifier or instruction expected. +// ParserError: (72-73): Expected primary expression. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/missing_variable_in_assign.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/missing_variable_in_assign.sol new file mode 100644 index 00000000..c8984333 --- /dev/null +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/missing_variable_in_assign.sol @@ -0,0 +1,11 @@ +contract C { + function f() public pure { + assembly { + let x := mload(0) + := 1 + } + } +} +// ---- +// ParserError: (87-88): Literal, identifier or instruction expected. +// ParserError: (87-88): Expected primary expression. -- cgit