File tree Expand file tree Collapse file tree 9 files changed +71
-0
lines changed Expand file tree Collapse file tree 9 files changed +71
-0
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,14 @@ test ! -x ./build/gfortran_*/app/unused
62
62
test ! -x ./build/gfortran_* /test/unused_test
63
63
popd
64
64
65
+ pushd tree_shake
66
+ " $fpm " build
67
+ " $fpm " run
68
+ " $fpm " test
69
+ test ! -e ./build/gfortran_* /tree_shake/src_farewell_m.f90.o
70
+ test ! -e ./build/gfortran_* /tree_shake/src_farewell_m.f90.o.log
71
+ popd
72
+
65
73
pushd version_file
66
74
" $fpm " build
67
75
" $fpm " run
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ the features demonstrated in each package and which versions of fpm are supporte
20
20
| makefile_complex | External build command (makefile); local path dependency | Y | N |
21
21
| program_with_module | App-only; module+program in single source file | Y | Y |
22
22
| submodules | Lib-only; submodules (3 levels) | N | Y |
23
+ | tree_shake | Test tree-shaking/pruning of unused module dependencies | N | Y |
23
24
| link_external | Link external library | N | Y |
24
25
| link_executable | Link external library to a single executable | N | Y |
25
26
| version_file | Read version number from a file in the project root | N | Y |
Original file line number Diff line number Diff line change
1
+ build /*
Original file line number Diff line number Diff line change
1
+ program say_Hello
2
+ use greet_m, only: make_greeting
3
+
4
+ implicit none
5
+
6
+ print * , make_greeting(" World" )
7
+ end program say_Hello
Original file line number Diff line number Diff line change
1
+ name = " tree_shake"
Original file line number Diff line number Diff line change
1
+ module farewell_m
2
+ use subdir_constants, only: FAREWELL_STR
3
+ implicit none
4
+ private
5
+
6
+ public :: make_farewell
7
+ contains
8
+ function make_farewell (name ) result(greeting)
9
+ character (len=* ), intent (in ) :: name
10
+ character (len= :), allocatable :: greeting
11
+
12
+ greeting = FAREWELL_STR // name // " !"
13
+ end function make_farewell
14
+ end module farewell_m
Original file line number Diff line number Diff line change
1
+ module greet_m
2
+ use subdir_constants, only: GREET_STR
3
+ implicit none
4
+ private
5
+
6
+ public :: make_greeting
7
+ contains
8
+ function make_greeting (name ) result(greeting)
9
+ character (len=* ), intent (in ) :: name
10
+ character (len= :), allocatable :: greeting
11
+
12
+ greeting = GREET_STR // name // " !"
13
+ end function make_greeting
14
+ end module greet_m
Original file line number Diff line number Diff line change
1
+ module subdir_constants
2
+ implicit none
3
+
4
+ character (* ), parameter :: GREET_STR = ' Hello, '
5
+ character (* ), parameter :: FAREWELL_STR = ' Goodbye, '
6
+
7
+ end module subdir_constants
Original file line number Diff line number Diff line change
1
+ program greet_test
2
+ use greet_m, only: make_greeting
3
+ use iso_fortran_env, only: error_unit, output_unit
4
+
5
+ implicit none
6
+
7
+ character (len= :), allocatable :: greeting
8
+
9
+ allocate (character (len= 0 ) :: greeting)
10
+ greeting = make_greeting(" World" )
11
+
12
+ if (greeting == " Hello, World!" ) then
13
+ write (output_unit, * ) " Passed"
14
+ else
15
+ write (error_unit, * ) " Failed"
16
+ call exit(1 )
17
+ end if
18
+ end program greet_test
You can’t perform that action at this time.
0 commit comments