You've already forked libadalang
mirror of
https://github.com/AdaCore/libadalang.git
synced 2026-02-12 12:28:54 -08:00
This commit also switches custom exception to Langkit's new mechanism to handle these automatically in all language bindings. TN: U518-009
28 lines
591 B
Python
28 lines
591 B
Python
"""
|
|
Test that libadalang.UnitProvider.for_project can resolve the designated
|
|
project from its path.
|
|
"""
|
|
|
|
import libadalang
|
|
|
|
|
|
def try_load(*args, **kwargs):
|
|
try:
|
|
libadalang.UnitProvider.for_project(*args, **kwargs)
|
|
except Exception as exc:
|
|
print(' exception {}: {}'.format(type(exc).__name__, exc))
|
|
else:
|
|
print(' success')
|
|
|
|
|
|
print('Load without project scope')
|
|
try_load('agg.gpr')
|
|
|
|
print('Load with ambiguous scope')
|
|
try_load('agg.gpr', project='arch')
|
|
|
|
print('Load with a project scope')
|
|
try_load('agg.gpr', project='arch32/arch.gpr')
|
|
|
|
print('Done.')
|