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
32
33
34
35
36
37
38
39
40
| # coding=utf8
"""
Test that C++ supports char8_t correctly.
"""
from __future__ import print_function
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
class CxxChar8_tTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipIf(compiler="clang", compiler_version=['<', '7.0'])
def test(self):
"""Test that C++ supports char8_t correctly."""
self.build()
exe = self.getBuildArtifact("a.out")
# Create a target by the debugger.
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
# FIXME: We should be able to test this with target variable, but the
# data formatter output is broken.
lldbutil.run_break_set_by_symbol(self, 'main')
self.runCmd("run", RUN_SUCCEEDED)
self.expect(
"frame variable a", substrs=["(char8_t)", "0x61 u8'a'"])
self.expect(
"frame variable ab", substrs=['(const char8_t *)' , 'u8"你好"'])
self.expect(
"frame variable abc", substrs=['(char8_t [9])', 'u8"你好"'])
|