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 @skipIfDarwin # Chained Fixups 15 @skipIf(compiler="clang", compiler_version=["<", "7.0"]) 16 def test_without_process(self): 17 """Test that C++ supports char8_t without a running process.""" 18 self.build() 19 lldbutil.run_to_breakpoint_make_target(self) 20 21 self.expect("target variable a", substrs=["char8_t", "0x61 u8'a'"]) 22 self.expect("target variable ab", substrs=["const char8_t *", 'u8"你好"']) 23 self.expect("target variable abc", substrs=["char8_t[9]", 'u8"你好"']) 24 25 self.expect_expr("a", result_type="char8_t", result_summary="0x61 u8'a'") 26 self.expect_expr("ab", result_type="const char8_t *", result_summary='u8"你好"') 27 28 # FIXME: This should work too. 29 self.expect("expr abc", substrs=['u8"你好"'], matching=False) 30 31 @skipIf(compiler="clang", compiler_version=["<", "7.0"]) 32 def test_with_process(self): 33 """Test that C++ supports char8_t with a running process.""" 34 self.build() 35 lldbutil.run_to_source_breakpoint( 36 self, "// break here", lldb.SBFileSpec("main.cpp") 37 ) 38 39 # As well as with it 40 self.expect_expr("a", result_type="char8_t", result_summary="0x61 u8'a'") 41 self.expect_expr("ab", result_type="const char8_t *", result_summary='u8"你好"') 42 self.expect_expr("abc", result_type="char8_t[9]", result_summary='u8"你好"') 43