Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ EXAMPLES = \
issue307_logical_array \
issue32 \
issue353_selected_kind \
issue363_missing_only_import \
issue357_name_conflict \
issue41_abstract_classes \
keep_single_interface \
Expand Down
9 changes: 9 additions & 0 deletions examples/issue363_missing_only_import/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
include ../make.meson.inc

NAME := global_mod
LIBSRC_WRAP_FPP_FILES := global_mod.f90

test: build
$(PYTHON) run.py

.PHONY: test
9 changes: 9 additions & 0 deletions examples/issue363_missing_only_import/Makefile.meson
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
include ../make.meson.inc

NAME := global_mod
LIBSRC_WRAP_FPP_FILES := global_mod.f90

test: build
$(PYTHON) run.py

.PHONY: test
10 changes: 10 additions & 0 deletions examples/issue363_missing_only_import/global_mod.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module global_mod
implicit none
integer :: number
contains
subroutine print_number(number)
integer, intent(in) :: number

print *, number
end subroutine print_number
end module global_mod
20 changes: 20 additions & 0 deletions examples/issue363_missing_only_import/run.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from pathlib import Path

import global_mod


def main():
wrapper = Path("f90wrap_global_mod.f90").read_text(encoding="utf-8")
expected = "use global_mod, only: print_number"
if expected not in wrapper:
raise SystemExit(
"Missing selective import in generated wrapper:\n"
f"{expected}\n\nGenerated wrapper:\n{wrapper}"
)

global_mod.global_mod.print_number(7)
print("Issue #363 test passed: generated wrapper uses selective import")


if __name__ == "__main__":
main()
Loading