Skip to content

Commit

Permalink
Fix grader rename error (rstudio#56)
Browse files Browse the repository at this point in the history
* fix grader -> gradethis in testthat.R

* fix rename grader to gradethis errors
  • Loading branch information
chendaniely authored Aug 2, 2019
1 parent c021340 commit cc918ba
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
12 changes: 6 additions & 6 deletions R/insert_exercise_check_code.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ insert_exercise_check_code <- function() {
rstudioapi::insertText(glue::glue("
```{r <<random_chunk_label>>, exercise = TRUE}
# student code
____
```
```{r <<random_chunk_label>>-hint-1}
Expand All @@ -25,7 +25,7 @@ insert_exercise_check_code <- function() {
```{r <<random_chunk_label>>-check}
# check code
grader::check_code()
gradethis::check_code()
```
" , .open = "<<", .close = ">>"))
# nolint end
Expand All @@ -38,7 +38,7 @@ insert_exercise_check_result <- function() {
rstudioapi::insertText(glue::glue("
```{r <<random_chunk_label>>, exercise = TRUE}
# student code
____
```
```{r <<random_chunk_label>>-hint-1}
Expand All @@ -52,9 +52,9 @@ insert_exercise_check_result <- function() {
```
```{r <<random_chunk_label>>-check}
grader::check_result(
grader::pass_if(~ .result == 1, \"YAY!\"),
grader::fail_if(~ .result == 2, \"Try Again.\")
gradethis::check_result(
gradethis::pass_if(~ identical(.result, 1), \"YAY!\"),
gradethis::fail_if(~ identical(.result, 2), \"Try Again.\")
)
```
" , .open = "<<", .close = ">>"))
Expand Down
2 changes: 1 addition & 1 deletion R/view_tutorial.R
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ add_tutorial <- function(name, package) {
}
}
cat(paste0(
'grader::view_tutorial(name = "',
'gradethis::view_tutorial(name = "',
name, '", package = "', package,
'") ## Learnr tutorial added on ',
Sys.Date()
Expand Down
File renamed without changes.
14 changes: 7 additions & 7 deletions inst/tutorials/grading-demo/grading-demo.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ runtime: shiny_prerendered

```{r setup, include=FALSE}
library(learnr)
library(grader)
library(gradethis)
tutorial_options(exercise.timelimit = 60, exercise.checker = grade_learnr)
knitr::opts_chunk$set(echo = FALSE)
Expand All @@ -19,7 +19,7 @@ knitr::opts_chunk$set(echo = FALSE)

### Check Exercise Result

`grader` can check for the final returned value. This grading approach does not inspect the code. It only inspects the final result.
`gradethis` can check for the final returned value. This grading approach does not inspect the code. It only inspects the final result.

See `?check_result` for more information.

Expand Down Expand Up @@ -77,7 +77,7 @@ check_result(

### Test Exercise Result

`grader` can test against for the final returned value. This grading approach does not inspect the code. It only inspects the final result.
`gradethis` can test against for the final returned value. This grading approach does not inspect the code. It only inspects the final result.

Writers can include as many testing functions as they would like. The test functions should accept a single result value to test against. If any test fails, it should throw an error. This error message will be returned back to the user by default. See `?test_result` for more information.

Expand Down Expand Up @@ -181,7 +181,7 @@ test_result(

### Check Exercise Code

`grader` can test against an exact code match. This grading approach does not inspect the computed result.
`gradethis` can test against an exact code match. This grading approach does not inspect the computed result.

This check method requires a `*-solution` code chunk containing the solution to compare. Only the last solution expression and last user expression will be matched.

Expand Down Expand Up @@ -245,7 +245,7 @@ check_code("Good job. Don't worry, things will soon get harder.")

## Custom Checking Code

`grader` can accept any checking method that returns a `grader::result` object. The example below returns a correct/incorrect answer with 50/50 probability.
`gradethis` can accept any checking method that returns a `gradethis::result` object. The example below returns a correct/incorrect answer with 50/50 probability.


````markdown
Expand All @@ -261,7 +261,7 @@ fifty_fifty_checker <- function(
user
) {
is_correct <- (runif(1) < 0.5)
grader::result(
gradethis::result(
x = user,
correct = is_correct,
message = ifelse(is_correct, correct, incorrect)
Expand Down Expand Up @@ -289,7 +289,7 @@ fifty_fifty_checker <- function(
user
) {
is_correct <- (runif(1) < 0.5)
grader::result(
gradethis::result(
x = user,
correct = is_correct,
message = ifelse(is_correct, correct, incorrect)
Expand Down
2 changes: 1 addition & 1 deletion inst/tutorials/recording-demo/recording-demo.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ runtime: shiny_prerendered

```{r setup, include=FALSE}
library(learnr)
library(grader)
library(gradethis)
library(googlesheets)
# Specify a googlesheet to record to
Expand Down
6 changes: 3 additions & 3 deletions inst/tutorials/scoping-rules/scoping-rules.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ The best way to reproduce the effects described in this tutorial is to run this
```{r eval = FALSE}
foo <- "Remember me." # this will be significant
devtools::install_github("rstudio-education/grader")
learnr::run_tutorial("scoping-rules", package = "grader")
devtools::install_github("rstudio-education/gradethis")
learnr::run_tutorial("scoping-rules", package = "gradethis")
```

### Knitr chunks
Expand Down Expand Up @@ -53,7 +53,7 @@ As a result, the objects in _your_ global environment will not be available when
To try this, close the tutorial and then run this code and click the Run Document button.

```{r eval = FALSE}
rstudioapi::navigateToFile(system.file("tutorials", "scoping-rules/scoping-rules.Rmd", package = "grader"))
rstudioapi::navigateToFile(system.file("tutorials", "scoping-rules/scoping-rules.Rmd", package = "gradethis"))
```

### The third case
Expand Down

0 comments on commit cc918ba

Please sign in to comment.