aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/syntaxTests/unicode_escape_literals.sol
blob: 4415d493b27a9b1f8da5d4aa37a338467bc93fd6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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): Invalid escape sequence.