aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-10-09 20:17:11 +0800
committerGitHub <noreply@github.com>2018-10-09 20:17:11 +0800
commit547b26d46462663b49631d55cf32dc10094eb4d4 (patch)
treef127a02462dfaa9f3b81b0a844de81f119b16514 /test
parent2547caf896b2d36e743ccd0a4c9cd420779786e1 (diff)
parent4bcd89105cf294d65443cbc7bfe2aaffd571f6d3 (diff)
downloaddexon-solidity-547b26d46462663b49631d55cf32dc10094eb4d4.tar.gz
dexon-solidity-547b26d46462663b49631d55cf32dc10094eb4d4.tar.zst
dexon-solidity-547b26d46462663b49631d55cf32dc10094eb4d4.zip
Merge pull request #5124 from lazaridiscom/1802-hex-error-reporting
use Token type for hex error, draft re #1802
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/SolidityScanner.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/test/libsolidity/SolidityScanner.cpp b/test/libsolidity/SolidityScanner.cpp
index 93db236b..6965d886 100644
--- a/test/libsolidity/SolidityScanner.cpp
+++ b/test/libsolidity/SolidityScanner.cpp
@@ -471,6 +471,8 @@ BOOST_AUTO_TEST_CASE(invalid_short_unicode_string_escape)
BOOST_CHECK_EQUAL(scanner.next(), Token::Illegal);
}
+// HEX STRING LITERAL
+
BOOST_AUTO_TEST_CASE(valid_hex_literal)
{
Scanner scanner(CharStream("{ hex\"00112233FF\""));
@@ -483,30 +485,32 @@ BOOST_AUTO_TEST_CASE(invalid_short_hex_literal)
{
Scanner scanner(CharStream("{ hex\"00112233F\""));
BOOST_CHECK_EQUAL(scanner.currentToken(), Token::LBrace);
- BOOST_CHECK_EQUAL(scanner.next(), Token::Illegal);
+ BOOST_CHECK_EQUAL(scanner.next(), Token::IllegalHex);
}
BOOST_AUTO_TEST_CASE(invalid_hex_literal_with_space)
{
Scanner scanner(CharStream("{ hex\"00112233FF \""));
BOOST_CHECK_EQUAL(scanner.currentToken(), Token::LBrace);
- BOOST_CHECK_EQUAL(scanner.next(), Token::Illegal);
+ BOOST_CHECK_EQUAL(scanner.next(), Token::IllegalHex);
}
BOOST_AUTO_TEST_CASE(invalid_hex_literal_with_wrong_quotes)
{
Scanner scanner(CharStream("{ hex\"00112233FF'"));
BOOST_CHECK_EQUAL(scanner.currentToken(), Token::LBrace);
- BOOST_CHECK_EQUAL(scanner.next(), Token::Illegal);
+ BOOST_CHECK_EQUAL(scanner.next(), Token::IllegalHex);
}
BOOST_AUTO_TEST_CASE(invalid_hex_literal_nonhex_string)
{
Scanner scanner(CharStream("{ hex\"hello\""));
BOOST_CHECK_EQUAL(scanner.currentToken(), Token::LBrace);
- BOOST_CHECK_EQUAL(scanner.next(), Token::Illegal);
+ BOOST_CHECK_EQUAL(scanner.next(), Token::IllegalHex);
}
+// COMMENTS
+
BOOST_AUTO_TEST_CASE(invalid_multiline_comment_close)
{
// This used to parse as "comment", "identifier"