Skip to content

Commit 9b480d2

Browse files
committed
Add: test package for app with submodules
1 parent 2570975 commit 9b480d2

File tree

10 files changed

+82
-0
lines changed

10 files changed

+82
-0
lines changed

ci/run_tests.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ pushd submodules
9292
"$fpm" build
9393
popd
9494

95+
pushd app_with_submodule
96+
"$fpm" run --all
97+
popd
98+
9599
pushd program_with_module
96100
"$fpm" build
97101
"$fpm" run --target Program_with_module

example_packages/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ the features demonstrated in each package and which versions of fpm are supporte
77
| Name | Features | Bootstrap (Haskell) fpm | fpm |
88
|---------------------|---------------------------------------------------------------|:-----------------------:|:---:|
99
| auto_discovery_off | Default layout with auto-discovery disabled | N | Y |
10+
| app_with_submodule | Submodules located in app directory (not src) | N | Y |
1011
| c_header_only | C header-only library | N | Y |
1112
| c_includes | C library with c include directory and dependency includes | N | Y |
1213
| circular_example | Local path dependency; circular dependency | Y | Y |
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build/*
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
submodule(parent) child1
2+
implicit none
3+
4+
interface
5+
module function my_fun() result (b)
6+
integer :: b
7+
end function my_fun
8+
end interface
9+
10+
contains
11+
12+
module procedure my_sub1
13+
a = my_fun()
14+
end procedure my_sub1
15+
16+
end submodule child1
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
submodule(parent:child1) grandchild
2+
implicit none
3+
4+
contains
5+
6+
module procedure my_fun
7+
b = 1
8+
end procedure my_fun
9+
10+
end submodule grandchild
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
program test
2+
use parent
3+
implicit none
4+
5+
integer :: a
6+
7+
call my_sub1(a)
8+
9+
if (a /= 1) then
10+
write(*,*) 'FAILED: Unexpected value of a'
11+
stop 1
12+
end if
13+
14+
end program test
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
submodule(parent) child2
2+
implicit none
3+
4+
contains
5+
6+
module procedure my_sub1
7+
a = 2
8+
end procedure my_sub1
9+
10+
end submodule child2
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
program test
2+
use parent
3+
implicit none
4+
5+
integer :: a
6+
7+
call my_sub1(a)
8+
9+
if (a /= 2) then
10+
write(*,*) 'FAILED: Unexpected value of a'
11+
stop 1
12+
end if
13+
14+
end program test
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
name = "app_with_submodule"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module parent
2+
implicit none
3+
4+
interface
5+
6+
module subroutine my_sub1(a)
7+
integer, intent(out) :: a
8+
end subroutine my_sub1
9+
end interface
10+
11+
end module parent

0 commit comments

Comments
 (0)