handle_test_subcommand Subroutine

subroutine handle_test_subcommand()

Arguments

None

Source Code

    subroutine handle_test_subcommand()
        integer :: nargs, i, test_exit_code
        character(len=256), allocatable :: test_args(:)

        ! Get all arguments except the first one (--test)
        nargs = command_argument_count() - 1

        if (nargs > 0) then
            allocate (test_args(nargs))
            do i = 1, nargs
                call get_command_argument(i + 1, test_args(i))
            end do
            call handle_test_command(test_args, test_exit_code)
            deallocate (test_args)
        else
            ! No additional arguments, run all tests
            allocate (test_args(0))
            call handle_test_command(test_args, test_exit_code)
            deallocate (test_args)
        end if

        if (test_exit_code /= 0) then
            stop 1
        end if
    end subroutine handle_test_subcommand