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
17    def test_nsurl_with_run_command(self):
18        """Test formatters for NSURL."""
19        self.appkit_tester_impl(self.nsurl_data_formatter_commands, True)
20
21    @skipUnlessDarwin
22    def test_nsurl_with_run_command_no_const(self):
23        """Test formatters for NSURL."""
24        self.appkit_tester_impl(self.nsurl_data_formatter_commands, False)
25
26    def nsurl_data_formatter_commands(self):
27        self.expect(
28            'frame variable cfurl_ref cfchildurl_ref cfgchildurl_ref',
29            substrs=[
30                '(CFURLRef) cfurl_ref = ', '@"http://www.foo.bar',
31                'cfchildurl_ref = ', '@"page.html -- http://www.foo.bar',
32                '(CFURLRef) cfgchildurl_ref = ',
33                '@"?whatever -- http://www.foo.bar/page.html"'
34            ])
35
36        self.expect(
37            'frame variable nsurl nsurl2 nsurl3',
38            substrs=[
39                '(NSURL *) nsurl = ', '@"http://www.foo.bar',
40                '(NSURL *) nsurl2 =', '@"page.html -- http://www.foo.bar',
41                '(NSURL *) nsurl3 = ',
42                '@"?whatever -- http://www.foo.bar/page.html"'
43            ])
44