datacamp / testwhat

Write Submission Correctness Tests for R exercises
https://datacamp.github.io/testwhat
GNU Affero General Public License v3.0
33 stars 24 forks source link

Throw error if overriding solution doesn't parse #194

Closed filipsch closed 5 years ago

filipsch commented 5 years ago

@Inouyesan came to me with an office hour question:

ex() %>% check_or(
  check_function(.,"mlogit") %>% {
      check_arg(.,"formula") %>% check_equal()
      check_arg(.,"data") %>% check_equal()
  },
  override_solution(.,"mlogit(Selection ~ 0 + Brand*Type, data=chocolate") %>% check_function("mlogit") %>% {
      check_arg(.,"formula") %>% check_equal()
      check_arg(.,"data") %>% check_equal()
  }
)

Turns out he forgot a ), which is very easy to do. The override_solution() function should throw an error in this case, so Shon knows what's up immediately.