@@ -464,14 +464,14 @@ subroutine test_iachar
464464 end subroutine test_iachar
465465
466466 subroutine test_move
467- type (string_type) :: from_string
468- type (string_type) :: to_string
469- character (len= :), allocatable :: from_char
467+ type (string_type) :: from_string, to_string
468+ character (len= :), allocatable :: from_char, to_char
470469
471470 from_string = " Move This String"
472471 from_char = " Move This Char"
473472 call check(from_string == " Move This String" .and. to_string == " " .and. &
474- & from_char == " Move This Char" , " move: test_case 1" )
473+ & from_char == " Move This Char" .and. .not. allocated (to_char), &
474+ & " move: test_case 1" )
475475
476476 ! string_type (allocated) --> string_type (not allocated)
477477 call move(from_string, to_string)
@@ -483,17 +483,27 @@ subroutine test_move
483483 & " move: test_case 3" )
484484
485485 ! string_type (allocated) --> character (not allocated)
486- call move(to_string, from_char )
487- call check(to_string == " " .and. from_char == " Move This String" , " move: test_case 4" )
486+ call move(to_string, to_char )
487+ call check(to_string == " " .and. to_char == " Move This String" , " move: test_case 4" )
488488
489489 ! character (allocated) --> string_type (allocated)
490- call move(from_char , from_string)
491- call check(.not. allocated (from_char ) .and. from_string == " Move This String" , &
490+ call move(to_char , from_string)
491+ call check(.not. allocated (to_char ) .and. from_string == " Move This String" , &
492492 & " move: test_case 5" )
493493
494+ from_char = " new char"
494495 ! character (allocated) --> string_type (allocated)
495496 call move(from_char, from_string)
496- call check(.not. allocated (from_char) .and. from_string == " " , " move: test_case 6" )
497+ call check(.not. allocated (from_char) .and. from_string == " new char" , " move: test_case 6" )
498+
499+ ! character (unallocated) --> string_type (allocated)
500+ call move(from_char, from_string)
501+ call check(from_string == " " , " move: test_case 7" )
502+
503+ from_string = " moving to self"
504+ ! string_type (allocated) --> string_type (allocated)
505+ call move(from_string, from_string)
506+ call check(from_string == " " , " move: test_case 8" )
497507
498508 end subroutine test_move
499509
0 commit comments