Skip to content

Commit 28ae5d3

Browse files
committed
Added test for checking for a mismatched test.
1 parent efc4e06 commit 28ae5d3

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

tests/testthat/test-df_mat_mul.R

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ test_that("Argument name is a character" ,{
1313

1414
test_that("The length of names does not differ from the length of the number
1515
of outputs" ,{
16-
expect_error(df_mat_mul(df, mat, c("a","b","c"),
17-
dplyr::num_range("X", 2:3)))
16+
expect_error(df_mat_mul(df, mat, c("a","b","c"), 2:3))
1817
})
1918

2019
test_that("The number of columns of the first data frame cannot differ from the
@@ -28,16 +27,15 @@ Z <- as.data.frame(as.matrix(df[2:3]) %*% mat)
2827
colnames(Z) <- c("z1","z2")
2928
output <- cbind(X,Z)
3029

31-
test_that("Matrix multiplication is being handled as expected", {
30+
test_that("Names are being handled properly", {
3231
expect_identical(df_mat_mul(df, mat, "z", 2:3),output)
33-
})
34-
35-
test_that("Names are used from the out_names field", {
3632
expect_identical(df_mat_mul(df, mat, c("z1","z2"), 2:3),output)
3733
})
3834

3935
test_that("Other tidyselect functionalities are working", {
4036
mult <- df_mat_mul(df, mat, "z", dplyr::num_range("X", 2:3))
4137
expect_identical(mult,output)
4238
expect_identical(df_mat_mul(df, mat, "z", 2, 3),output)
39+
# Mismatched names should not work:
40+
expect_error(df_mat_mul(df, mat, "z", dplyr::num_range("Y", 2:3)))
4341
})

0 commit comments

Comments
 (0)