| 1 |
""" |
| 2 |
Test the with statement for a project file in sub dirs |
| 3 |
""" |
| 4 |
|
| 5 |
from glob import glob |
| 6 |
import os |
| 7 |
|
| 8 |
from drivers.alr import run_alr |
| 9 |
from drivers.asserts import assert_eq, assert_match |
| 10 |
|
| 11 |
import re |
| 12 |
import platform |
| 13 |
from drivers.helpers import check_line_in |
| 14 |
|
| 15 |
# Get the "hello" project and enter its directory |
| 16 |
run_alr('init', '--bin', 'myhello') |
| 17 |
os.chdir(glob('myhello*')[0]) |
| 18 |
|
| 19 |
# Get dependencies that should also add a with statement in myhello.gpr |
| 20 |
run_alr('with', 'libhello') |
| 21 |
run_alr('with', 'gpr_in_subdir') |
| 22 |
|
| 23 |
check_line_in('config/myhello_config.gpr', 'with "libhello.gpr";') |
| 24 |
|
| 25 |
# When the crate declares a project file: `dir1/dir2/dir3/prj.gpr`, the with |
| 26 |
# statement has to be `with "prj.gpr"`. Without the sub-dirs because |
| 27 |
# GPR_PROJECT_PATH is already set with dirs that contain the project file. |
| 28 |
check_line_in('config/myhello_config.gpr', 'with "gpr_in_subdir.gpr";') |
| 29 |
|
| 30 |
print('SUCCESS') |