context("linreg")
test_that("weather rejects incorect input", {
expect_error(weather(as.vector(1)))
})
test_weather<-weather("Linkoping")
test_that("Output works", {
expect_output(print(test_weather),"Country: Sweden")
expect_output(print(test_weather),"City: Linkoping")
expect_output(print(weather("Linköpings university")),"Linköpings university is not found.")
expect_output(print(test_weather),"Local time:")
expect_output(print(test_weather),"Temperature:")
expect_output(print(test_weather),"Wind speed:")
})
test_that("Return is a list", {
expect_equal(class(test_weather), "weather")
expect_equal(length(test_weather),3)
expect_equal(test_weather$location$lat,"58.417")
expect_equal(test_weather$request$type,"City")
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.