• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1"""Test that the Objective-C syntax for dictionary/array literals and indexing works"""
2
3
4import lldb
5from lldbsuite.test.decorators import *
6from lldbsuite.test.lldbtest import *
7from lldbsuite.test import lldbutil
8
9from ObjCNewSyntaxTest import ObjCNewSyntaxTest
10
11
12class ObjCNewSyntaxTestCaseLiteral(ObjCNewSyntaxTest):
13
14    @skipIf(macos_version=["<", "10.12"])
15    @expectedFailureAll(archs=["i[3-6]86"])
16    def test_char_literal(self):
17        self.runToBreakpoint()
18
19        self.expect("expr --object-description -- @'a'",
20                    VARIABLES_DISPLAYED_CORRECTLY, substrs=[str(ord('a'))])
21
22    @skipIf(macos_version=["<", "10.12"])
23    @expectedFailureAll(archs=["i[3-6]86"])
24    def test_integer_literals(self):
25        self.runToBreakpoint()
26
27        self.expect(
28            "expr --object-description -- @1",
29            VARIABLES_DISPLAYED_CORRECTLY,
30            substrs=["1"])
31
32        self.expect(
33            "expr --object-description -- @1l",
34            VARIABLES_DISPLAYED_CORRECTLY,
35            substrs=["1"])
36
37        self.expect(
38            "expr --object-description -- @1ul",
39            VARIABLES_DISPLAYED_CORRECTLY,
40            substrs=["1"])
41
42        self.expect(
43            "expr --object-description -- @1ll",
44            VARIABLES_DISPLAYED_CORRECTLY,
45            substrs=["1"])
46
47        self.expect(
48            "expr --object-description -- @1ull",
49            VARIABLES_DISPLAYED_CORRECTLY,
50            substrs=["1"])
51
52    @skipIf(macos_version=["<", "10.12"])
53    @expectedFailureAll(archs=["i[3-6]86"])
54    def test_float_literal(self):
55        self.runToBreakpoint()
56
57        self.expect("expr -- @123.45", VARIABLES_DISPLAYED_CORRECTLY,
58                    substrs=["NSNumber", "123.45"])
59
60    @skipIf(macos_version=["<", "10.12"])
61    @expectedFailureAll(archs=["i[3-6]86"])
62    def test_expressions_in_literals(self):
63        self.runToBreakpoint()
64
65        self.expect(
66            "expr --object-description -- @( 1 + 3 )",
67            VARIABLES_DISPLAYED_CORRECTLY,
68            substrs=["4"])
69        self.expect(
70            "expr -- @((char*)\"Hello world\" + 6)",
71            VARIABLES_DISPLAYED_CORRECTLY,
72            substrs=[
73                "NSString",
74                "world"])
75