-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest-version_diff.R
More file actions
33 lines (26 loc) · 967 Bytes
/
Copy pathtest-version_diff.R
File metadata and controls
33 lines (26 loc) · 967 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
context("version increment - DESCRIPTION/README badge/NEWS")
skip_on_cran()
skip_on_appveyor()
skip_on_travis()
return_code <- system("git diff", intern = TRUE)
# only if there are diffs this check should be made
# i.e. users of the package should not be confronted
# with this test
if (length(return_code) == 0) {
skip("No diffs in git.")
}
grep_version <- grep("Version: \\d\\.\\d\\.\\d", return_code)
grep_badge <- grep("https://img.shields.io/badge/", return_code)
grep_news <- grep("NEWS.md", return_code)
# should return length 2 if the Version number has changed
# this will only check if the developer locally runs the tests
# travis will skip this
test_that("Version number has been incremented in DESCRIPTION", {
expect_true(length(grep_version) >= 2)
})
test_that("Version number has been incremented in README badge", {
expect_true(length(grep_badge) >= 2)
})
test_that("NEWS.md has been extended", {
expect_true(length(grep_news) >= 2)
})