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)
20
21    def nsurl_data_formatter_commands(self):
22        self.expect(
23            'frame variable cfurl_ref cfchildurl_ref cfgchildurl_ref',
24            substrs=[
25                '(CFURLRef) cfurl_ref = ', '@"http://www.foo.bar',
26                'cfchildurl_ref = ', '@"page.html -- http://www.foo.bar',
27                '(CFURLRef) cfgchildurl_ref = ',
28                '@"?whatever -- http://www.foo.bar/page.html"'
29            ])
30
31        self.expect(
32            'frame variable nsurl nsurl2 nsurl3',
33            substrs=[
34                '(NSURL *) nsurl = ', '@"http://www.foo.bar',
35                '(NSURL *) nsurl2 =', '@"page.html -- http://www.foo.bar',
36                '(NSURL *) nsurl3 = ',
37                '@"?whatever -- http://www.foo.bar/page.html"'
38            ])
39