@@ -34,7 +34,8 @@ subroutine collect_npy(testsuite)
34
34
new_unittest(" duplicate-descr" , test_duplicate_descr, should_fail= .true. ), &
35
35
new_unittest(" missing-descr" , test_missing_descr, should_fail= .true. ), &
36
36
new_unittest(" missing-fortran_order" , test_missing_fortran_order, should_fail= .true. ), &
37
- new_unittest(" missing-shape" , test_missing_shape, should_fail= .true. ) &
37
+ new_unittest(" missing-shape" , test_missing_shape, should_fail= .true. ), &
38
+ new_unittest(" iomsg-deallocated" , test_iomsg_deallocated) &
38
39
]
39
40
end subroutine collect_npy
40
41
@@ -619,6 +620,27 @@ subroutine test_missing_shape(error)
619
620
call check(error, stat, msg)
620
621
end subroutine test_missing_shape
621
622
623
+ subroutine test_iomsg_deallocated (error )
624
+ ! > Error handling
625
+ type (error_type), allocatable , intent (out ) :: error
626
+
627
+ integer :: stat
628
+ character (len= :), allocatable :: msg
629
+
630
+ character (len=* ), parameter :: filename = " .test-iomsg-deallocated.npy"
631
+ real (sp), allocatable :: input(:, :), output(:, :)
632
+
633
+ msg = " This message should be deallocated."
634
+
635
+ allocate (input(12 , 5 ))
636
+ call random_number (input)
637
+ call save_npy(filename, input, stat, msg)
638
+ call delete_file(filename)
639
+
640
+ call check(error,.not. allocated (msg), " Message wrongly allocated." )
641
+
642
+ end subroutine
643
+
622
644
subroutine delete_file (filename )
623
645
character (len=* ), intent (in ) :: filename
624
646
0 commit comments