Skip to content

Commit

Permalink
more minor bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
WilCrofter committed Sep 24, 2014
1 parent 034834a commit ce47b54
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions R/answerTests2.R
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ omnitest <- function(correctExpr=NULL, correctVal=NULL, strict=FALSE, eval_for_c
}
# Testing for both correct expression and correct value
# Value must be character or single number
valGood <- TRUE
valGood <- as.logical(NA)
if(!is.null(correctVal)){
if(is.character(e$val)){
valResults <- expectThat(e$val,
Expand All @@ -214,13 +214,13 @@ omnitest <- function(correctExpr=NULL, correctVal=NULL, strict=FALSE, eval_for_c
if(!is.null(correctExpr)){
err <- try({
good_expr <- parse(text=correctExpr)[[1]]
ans <- is_robust_match(good_expr, e$expr, eval_for_class, eval_for_class)
ans <- is_robust_match(good_expr, e$expr, eval_for_class, eval_env)
}, silent=TRUE)
exprGood <- ifelse(is(err, "try-error"), expr_identical_to(correctExpr), ans)
}
if(valGood && exprGood){
if((isTRUE(valGood) || is.na(valGood)) && exprGood){
return(TRUE)
} else if (valGood && !exprGood && !strict){
} else if (isTRUE(valGood) && !exprGood && !strict){
swirl_out("That's not the expression I expected but it works.")
swirl_out("I've executed the correct expression in case the result is needed in an upcoming question.")
eval(parse(text=correctExpr),globalenv())
Expand Down

0 comments on commit ce47b54

Please sign in to comment.