Skip to content

Commit

Permalink
fix bug in match_call custom test
Browse files Browse the repository at this point in the history
  • Loading branch information
ncarchedi committed Jul 10, 2014
1 parent 7a55973 commit cbd89d1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions R_Programming/Simulation/customTests.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@ match_call <- function(correct_call = NULL) {
if(is.null(correct_call)) return(TRUE)
# Fills out a function call with full argument names
expand_call <- function(call_string) {
# Quote expression
qcall <- parse(text=call_string)[[1]]
# If expression is not greater than length 1...
if(length(qcall) <= 1) return(qcall)
# Get function from function name
fun <- match.fun(qcall[[1]])
# match.call() does not support primitive functions
if(is.primitive(fun)) return(qcall)
# Return expanded function call
match.call(fun, qcall)
}
# Get full correct call
Expand Down

0 comments on commit cbd89d1

Please sign in to comment.