From aee13d709c7083d2b3e1b567f05f1e1624073dbc Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Tue, 24 Jul 2018 02:13:38 +0100 Subject: Scanner tests for all escapes --- test/libsolidity/SolidityScanner.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/libsolidity') diff --git a/test/libsolidity/SolidityScanner.cpp b/test/libsolidity/SolidityScanner.cpp index f455c5eb..6cc3032f 100644 --- a/test/libsolidity/SolidityScanner.cpp +++ b/test/libsolidity/SolidityScanner.cpp @@ -64,6 +64,14 @@ BOOST_AUTO_TEST_CASE(string_escapes) BOOST_CHECK_EQUAL(scanner.currentLiteral(), "aa"); } +BOOST_AUTO_TEST_CASE(string_escapes_all) +{ + Scanner scanner(CharStream(" { \"a\\x61\\b\\f\\n\\r\\t\\v\"")); + BOOST_CHECK_EQUAL(scanner.currentToken(), Token::LBrace); + BOOST_CHECK_EQUAL(scanner.next(), Token::StringLiteral); + BOOST_CHECK_EQUAL(scanner.currentLiteral(), "aa\b\f\n\r\t\v"); +} + BOOST_AUTO_TEST_CASE(string_escapes_with_zero) { Scanner scanner(CharStream(" { \"a\\x61\\x00abc\"")); -- cgit