1# coding=utf8 2""" 3Test that C++ supports char8_t correctly. 4""" 5 6 7import lldb 8from lldbsuite.test.decorators import * 9from lldbsuite.test.lldbtest import * 10import lldbsuite.test.lldbutil as lldbutil 11 12 13class CxxChar8_tTestCase(TestBase): 14 15 mydir = TestBase.compute_mydir(__file__) 16 17 @skipIf(compiler="clang", compiler_version=['<', '7.0']) 18 def test(self): 19 """Test that C++ supports char8_t correctly.""" 20 self.build() 21 exe = self.getBuildArtifact("a.out") 22 23 # Create a target by the debugger. 24 target = self.dbg.CreateTarget(exe) 25 self.assertTrue(target, VALID_TARGET) 26 27 # FIXME: We should be able to test this with target variable, but the 28 # data formatter output is broken. 29 lldbutil.run_break_set_by_symbol(self, 'main') 30 self.runCmd("run", RUN_SUCCEEDED) 31 32 self.expect_expr("a", result_type="char8_t", result_summary="0x61 u8'a'") 33 self.expect_expr("ab", result_type="const char8_t *", result_summary='u8"你好"') 34 self.expect_expr("abc", result_type="char8_t [9]", result_summary='u8"你好"') 35