# Path: symsynd/demangle.py
# def demangle_swift_symbol(symbol, simplified=False):
#     return _demangle(lib.demangle_swift, symbol, simplified=simplified)
# 
# def demangle_cpp_symbol(symbol, simplified=False):
#     return _demangle(lib.demangle_cpp, symbol, simplified=simplified)


from symsynd import demangle_swift_symbol, demangle_cpp_symbol


def test_swift_demangle():
    mangled = '_TFC12Swift_Tester14ViewController11doSomethingfS0_FT_T_'
    expected = (
        'Swift_Tester.ViewController.doSomething '
        '(Swift_Tester.ViewController) -> () -> ()'
    )
    assert demangle_swift_symbol(mangled) == expected


def test_swift_demangle_options():
    mangled = (
        '_TTWVSC29UIApplicationLaunchOptionsKeys21_ObjectiveCBridgeable'
        '5UIKitZFS0_36_unconditionallyBridgeFromObjectiveCfGSqwx15_'
        'ObjectiveCType_x'
    )
    default_expected = (
        u'protocol witness for static Swift._ObjectiveCBridgeable._'

# Path: symsynd/demangle.py
# def demangle_swift_symbol(symbol, simplified=False):
#     return _demangle(lib.demangle_swift, symbol, simplified=simplified)
# 
# def demangle_cpp_symbol(symbol, simplified=False):
#     return _demangle(lib.demangle_cpp, symbol, simplified=simplified)


# Path: tests/test_demangle.py
from symsynd import demangle_swift_symbol, demangle_cpp_symbol



def test_swift_demangle():
    mangled = '_TFC12Swift_Tester14ViewController11doSomethingfS0_FT_T_'
    expected = (
        'Swift_Tester.ViewController.doSomething '
        '(Swift_Tester.ViewController) -> () -> ()'
    )
    assert demangle_swift_symbol(mangled) == expected


def test_swift_demangle_options():
    mangled = (
        '_TTWVSC29UIApplicationLaunchOptionsKeys21_ObjectiveCBridgeable'
        '5UIKitZFS0_36_unconditionallyBridgeFromObjectiveCfGSqwx15_'
        'ObjectiveCType_x'
    )
    default_expected = (
        u'protocol witness for static Swift._ObjectiveCBridgeable._'

        u'unconditionallyBridgeFromObjectiveC (Swift.Optional<A._'