1# encoding: utf-8
2"""
3Test lldb data formatter subsystem.
4"""
5
6
7import lldb
8from lldbsuite.test.decorators import *
9from lldbsuite.test.lldbtest import *
10from lldbsuite.test import lldbutil
11
12from ObjCDataFormatterTestCase import ObjCDataFormatterTestCase
13
14
15class ObjCDataFormatterNSURL(ObjCDataFormatterTestCase):
16    def test_nsurl_with_run_command(self):
17        """Test formatters for NSURL."""
18        self.appkit_tester_impl(self.nsurl_data_formatter_commands, True)
19
20    @skipUnlessDarwin
21    def test_nsurl_with_run_command_no_const(self):
22        """Test formatters for NSURL."""
23        self.appkit_tester_impl(self.nsurl_data_formatter_commands, False)
24
25    def nsurl_data_formatter_commands(self):
26        self.expect(
27            "frame variable cfurl_ref cfchildurl_ref cfgchildurl_ref",
28            substrs=[
29                "(CFURLRef) cfurl_ref = ",
30                '@"http://www.foo.bar',
31                "cfchildurl_ref = ",
32                '@"page.html -- http://www.foo.bar',
33                "(CFURLRef) cfgchildurl_ref = ",
34                '@"?whatever -- http://www.foo.bar/page.html"',
35            ],
36        )
37
38        self.expect(
39            "frame variable nsurl nsurl2 nsurl3",
40            substrs=[
41                "(NSURL *) nsurl = ",
42                '@"http://www.foo.bar',
43                "(NSURL *) nsurl2 =",
44                '@"page.html -- http://www.foo.bar',
45                "(NSURL *) nsurl3 = ",
46                '@"?whatever -- http://www.foo.bar/page.html"',
47            ],
48        )
49