1# coding=utf8 2""" 3Test that C++ supports wchar_t correctly. 4""" 5 6 7 8import lldb 9from lldbsuite.test.lldbtest import * 10import lldbsuite.test.lldbutil as lldbutil 11 12 13class CxxWCharTTestCase(TestBase): 14 15 def test(self): 16 """Test that C++ supports wchar_t correctly.""" 17 self.build() 18 lldbutil.run_to_source_breakpoint(self, "// break here", lldb.SBFileSpec("main.cpp")) 19 20 # Check that we correctly report templates on wchar_t 21 self.expect_var_path("foo_y", type="Foo<wchar_t>") 22 23 # Check that we correctly report templates on int 24 self.expect_var_path("foo_x", type="Foo<int>") 25 26 # Check that we correctly report wchar_t 27 self.expect_var_path("foo_y.object", type="wchar_t") 28 29 # Check that we correctly report int 30 self.expect_var_path("foo_x.object", type="int") 31 32 # Check that we can run expressions that return wchar_t 33 self.expect("expression L'a'", substrs=['(wchar_t) $', "L'a'"]) 34 35 # Mazel Tov if this works! 36 self.expect("frame variable mazeltov", 37 substrs=['(const wchar_t *) mazeltov = ', 'L"מזל טוב"']) 38 39 self.expect( 40 "frame variable ws_NULL", 41 substrs=['(wchar_t *) ws_NULL = 0x0']) 42 self.expect("frame variable ws_empty", substrs=[' L""']) 43 44 self.expect("frame variable array", substrs=[ 45 'L"Hey, I\'m a super wchar_t string']) 46 self.expect("frame variable array", substrs=['[0]'], matching=False) 47 48 self.expect('frame variable wchar_zero', substrs=["L'\\0'"]) 49 self.expect('expression wchar_zero', substrs=["L'\\0'"]) 50