# file      : libbuild2/cc/lexer+char-literal.test.testscript
# license   : MIT; see accompanying LICENSE file

# Test character literals.
#

: normal
:
$* <<EOI >>EOO
'a'
'aa'
'"'
EOI
<char literal>
<char literal>
<char literal>
EOO

: prefix
:
$* <<EOI >>EOO
L'a'
U'a'
u'a'
u8'a'
u8R'a'
EOI
<char literal>
<char literal>
<char literal>
<char literal>
'u8R'
<char literal>
EOO

: suffix
:
$* <<EOI >>EOO
'a'x
'a'_X123
EOI
<char literal>
<char literal>
EOO

: escape
:
$* <<EOI >>EOO
'\''
'\\'
'\\\''
'\n'
U'\U0001f34c'
EOI
<char literal>
<char literal>
<char literal>
<char literal>
<char literal>
EOO

: unterminated
:
$* <"'a" 2>>EOE != 0
<stdin>:1:1: error: unterminated character literal
EOE