fortrangoingonforty/fgof-process / c05bfe7

Browse files

Validate env unset

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
c05bfe7e23a1fb7a607779a2ee1707a1634a9d43
Parents
a2f8ba3
Tree
a02972b

2 changed files

StatusFile+-
M src/fgof_process.f90 5 0
M test/test_validation.f90 5 0
src/fgof_process.f90modified
@@ -130,6 +130,11 @@ contains
130130
             call set_error(res, FGOF_PROCESS_ERR_INVALID_OPTION, "env_unset entries must not be empty")
131131
             return
132132
           end if
133
+
134
+          if (index(options%env_unset(i), "=") > 0) then
135
+            call set_error(res, FGOF_PROCESS_ERR_INVALID_OPTION, "env_unset entries must use KEY format")
136
+            return
137
+          end if
133138
         end do
134139
       end if
135140
     end if
test/test_validation.f90modified
@@ -30,4 +30,9 @@ program test_validation
3030
   opts%timeout_ms = -1
3131
   res = run(shell_cmd, opts)
3232
   if (res%error_code /= FGOF_PROCESS_ERR_INVALID_OPTION) error stop "negative timeout should be invalid"
33
+
34
+  opts = process_options()
35
+  opts%env_unset = ["FGOF_PROCESS_TEST=hello"]
36
+  res = run(shell_cmd, opts)
37
+  if (res%error_code /= FGOF_PROCESS_ERR_INVALID_OPTION) error stop "env_unset entries with '=' should be invalid"
3338
 end program test_validation