• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# coding=utf8
2"""
3Test that the expression parser returns proper Unicode strings.
4"""
5
6
7
8import lldb
9from lldbsuite.test.decorators import *
10from lldbsuite.test.lldbtest import *
11from lldbsuite.test import lldbutil
12
13# this test case fails because of rdar://12991846
14# the expression parser does not deal correctly with Unicode expressions
15# e.g.
16#(lldb) expr L"Hello"
17#(const wchar_t [6]) $0 = {
18#  [0] = \0\0\0\0
19#  [1] = \0\0\0\0
20#  [2] = \0\0\0\0
21#  [3] = \0\0\0\0
22#  [4] = H\0\0\0
23#  [5] = e\0\0\0
24#}
25
26
27class UnicodeLiteralsTestCase(TestBase):
28
29    mydir = TestBase.compute_mydir(__file__)
30
31    def test_expr1(self):
32        """Test that the expression parser returns proper Unicode strings."""
33        self.rdar12991846(expr=1)
34
35    def test_expr2(self):
36        """Test that the expression parser returns proper Unicode strings."""
37        self.rdar12991846(expr=2)
38
39    def test_expr3(self):
40        """Test that the expression parser returns proper Unicode strings."""
41        self.rdar12991846(expr=3)
42
43    def rdar12991846(self, expr=None):
44        """Test that the expression parser returns proper Unicode strings."""
45        if self.getArchitecture() in ['i386']:
46            self.skipTest(
47                "Skipping because this test is known to crash on i386")
48
49        self.build()
50        lldbutil.run_to_source_breakpoint(self, "// Set break point at this line", lldb.SBFileSpec("main.cpp"))
51
52        if expr == 1:
53            self.expect('expression L"hello"', substrs=['hello'])
54
55        if expr == 2:
56            self.expect('expression u"hello"', substrs=['hello'])
57
58        if expr == 3:
59            self.expect('expression U"hello"', substrs=['hello'])
60