diff options
author | herrBez <bez.mirko@gmail.com> | 2018-09-15 19:03:47 +0800 |
---|---|---|
committer | herrBez <bez.mirko@gmail.com> | 2018-09-21 05:02:44 +0800 |
commit | faa0caae084363f6809341ddb63f75d6c682b175 (patch) | |
tree | 179821780a96e1fa4393627ea8a706b0ff4c69ca /test/libsolidity/syntaxTests/unicode_escape_literals.sol | |
parent | 2409986cf305c25d6a3d46c122521c7769dc7cd7 (diff) | |
download | dexon-solidity-faa0caae084363f6809341ddb63f75d6c682b175.tar dexon-solidity-faa0caae084363f6809341ddb63f75d6c682b175.tar.gz dexon-solidity-faa0caae084363f6809341ddb63f75d6c682b175.tar.bz2 dexon-solidity-faa0caae084363f6809341ddb63f75d6c682b175.tar.lz dexon-solidity-faa0caae084363f6809341ddb63f75d6c682b175.tar.xz dexon-solidity-faa0caae084363f6809341ddb63f75d6c682b175.tar.zst dexon-solidity-faa0caae084363f6809341ddb63f75d6c682b175.zip |
Add syntax tests to augment the test coverage of
libsolidity/parsing/Scanner.cpp and libsolidity/parsing/Scanner.h
Fix #4627 and PR #5003.
- Add multiline comment test
- Add upper case hex literal test
- Add test for unicode escapes
- Add test for strings with escaped newlines
- Add test for string escapes
- Add test for strings that do not terminate before end of file
- Add test for unterminated blocks
Diffstat (limited to 'test/libsolidity/syntaxTests/unicode_escape_literals.sol')
-rw-r--r-- | test/libsolidity/syntaxTests/unicode_escape_literals.sol | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/libsolidity/syntaxTests/unicode_escape_literals.sol b/test/libsolidity/syntaxTests/unicode_escape_literals.sol new file mode 100644 index 00000000..a340487b --- /dev/null +++ b/test/libsolidity/syntaxTests/unicode_escape_literals.sol @@ -0,0 +1,31 @@ +contract test { + + function oneByteUTF8() public pure returns (bytes32) { + bytes32 usdollar = "aaa\u0024aaa"; + return usdollar; + } + + function twoBytesUTF8() public pure returns (bytes32) { + bytes32 cent = "aaa\u00A2aaa"; + return cent; + } + + function threeBytesUTF8() public pure returns (bytes32) { + bytes32 eur = "aaa\u20ACaaa"; + return eur; + } + + function together() public pure returns (bytes32) { + bytes32 res = "\u0024\u00A2\u20AC"; + return res; + } + + // this function returns an invalid unicode character + function invalidLiteral() public pure returns(bytes32) { + bytes32 invalid = "\u00xx"; + return invalid; + } + +} +// ---- +// ParserError: (678-681): Expected primary expression. |