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 mydir = TestBase.compute_mydir(__file__) 16 17 def test(self): 18 """Test that C++ supports wchar_t correctly.""" 19 self.build() 20 lldbutil.run_to_source_breakpoint(self, "// break here", lldb.SBFileSpec("main.cpp")) 21 22 # Check that we correctly report templates on wchar_t 23 self.expect("frame variable foo_y", 24 substrs=['(Foo<wchar_t>) foo_y = ']) 25 26 # Check that we correctly report templates on int 27 self.expect("frame variable foo_x", 28 substrs=['(Foo<int>) foo_x = ']) 29 30 # Check that we correctly report wchar_t 31 self.expect("frame variable foo_y.object", 32 substrs=['(wchar_t) foo_y.object = ']) 33 34 # Check that we correctly report int 35 self.expect("frame variable foo_x.object", 36 substrs=['(int) foo_x.object = ']) 37 38 # Check that we can run expressions that return wchar_t 39 self.expect("expression L'a'", substrs=['(wchar_t) $', "L'a'"]) 40 41 # Mazel Tov if this works! 42 self.expect("frame variable mazeltov", 43 substrs=['(const wchar_t *) mazeltov = ', 'L"מזל טוב"']) 44 45 self.expect( 46 "frame variable ws_NULL", 47 substrs=['(wchar_t *) ws_NULL = 0x0']) 48 self.expect("frame variable ws_empty", substrs=[' L""']) 49 50 self.expect("frame variable array", substrs=[ 51 'L"Hey, I\'m a super wchar_t string']) 52 self.expect("frame variable array", substrs=['[0]'], matching=False) 53 54 self.expect('frame variable wchar_zero', substrs=["L'\\0'"]) 55 self.expect('expression wchar_zero', substrs=["L'\\0'"]) 56