Skip to content

Instantly share code, notes, and snippets.

@BrianDiggs
Created December 13, 2012 23:57
Show Gist options
  • Save BrianDiggs/4281241 to your computer and use it in GitHub Desktop.
Save BrianDiggs/4281241 to your computer and use it in GitHub Desktop.
git bisect script used to find where the ordering problem was introduced for tidyverse/ggplot2#721
## To run this script:
## git bisect reset
## git bisect start ggplot2-0.9.2.1 f4faab0
## git bisect run "C:\Program Files\R\R-2.15.2\bin\R" -f mytestscript.r
cat("\n===== Running test script ======\n")
library("bisectr")
library("digest")
library("methods")
## This is the test function. It is defined here and run later.
## A test that requires visual inspection and manual response
testRunInteractive <- function() {
## ... Test code here ...
DF <- expand.grid(A = c("A","B"), B = c("a", "b"))
DF$y <- seq_len(nrow(DF))
DF$B <- factor(DF$B, levels=rev(levels(DF$B)))
p <- ggplot(DF, aes(x=A, y=y, fill=B)) +
geom_bar(stat="identity")
## ... End test code ...
## Need to manually open graphics window because we're in a script
windows()
## Must explicitly print ggplot object because we're in a script
print(p)
## On some platforms we need to wait a little bit to allow the plot to render
Sys.sleep(0.75)
## User must visually inspect and mark good/bad/skip
bisect_return_interactive()
}
devtools::load_all(".", reset=TRUE)
## If error, mark SKIP
bisect_runtest(testRunInteractive, on_error = "skip")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment