aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/syntaxTests/unicode_escape_literals.sol
blob: a340487b15c7beea30bf3cdacc319b9716ecac49 (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): Expected primary expression.