Skip to content

Commit

Permalink
Handle return value history for custom fakes
Browse files Browse the repository at this point in the history
  • Loading branch information
henningrehn committed Aug 21, 2019
1 parent ab47e7f commit b9f11dc
Show file tree
Hide file tree
Showing 3 changed files with 216 additions and 43 deletions.
9 changes: 8 additions & 1 deletion fakegen.rb
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,14 @@ def output_function_body(arg_count, has_varargs, is_value_function)
putd_backslash "}"
}
putd_backslash "}"
putd_backslash "if (FUNCNAME##_fake.custom_fake) #{return_type}FUNCNAME##_fake.custom_fake(#{arg_list(arg_count)});"
putd_backslash "if (FUNCNAME##_fake.custom_fake){ "
indent {
putd_backslash "RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(#{arg_list(arg_count)});" unless not is_value_function
putd_backslash "SAVE_RET_HISTORY(FUNCNAME, ret);" unless not is_value_function
putd_backslash "return ret;" unless not is_value_function
putd_backslash "#{return_type}FUNCNAME##_fake.custom_fake(#{arg_list(arg_count)});"
}
putd_backslash "}"
end

putd_backslash "RETURN_FAKE_RESULT(FUNCNAME)" if is_value_function
Expand Down
Loading

0 comments on commit b9f11dc

Please sign in to comment.