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_var_path("foo_y", type="Foo<wchar_t>") 24 25 # Check that we correctly report templates on int 26 self.expect_var_path("foo_x", type="Foo<int>") 27 28 # Check that we correctly report wchar_t 29 self.expect_var_path("foo_y.object", type="wchar_t") 30 31 # Check that we correctly report int 32 self.expect_var_path("foo_x.object", type="int") 33 34 # Check that we can run expressions that return wchar_t 35 self.expect("expression L'a'", substrs=['(wchar_t) $', "L'a'"]) 36 37 # Mazel Tov if this works! 38 self.expect("frame variable mazeltov", 39 substrs=['(const wchar_t *) mazeltov = ', 'L"מזל טוב"']) 40 41 self.expect( 42 "frame variable ws_NULL", 43 substrs=['(wchar_t *) ws_NULL = 0x0']) 44 self.expect("frame variable ws_empty", substrs=[' L""']) 45 46 self.expect("frame variable array", substrs=[ 47 'L"Hey, I\'m a super wchar_t string']) 48 self.expect("frame variable array", substrs=['[0]'], matching=False) 49 50 self.expect('frame variable wchar_zero', substrs=["L'\\0'"]) 51 self.expect('expression wchar_zero', substrs=["L'\\0'"]) 52