Skip to content

Commit f2ea79d

Browse files
committed
removed redundant existence checks, explicitly check silent return
1 parent 65b0844 commit f2ea79d

11 files changed

+14
-66
lines changed

tests/testthat/test-smk-ds.abs.R

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ test_that("setup", {
2727

2828
# context("ds.abs::smk")
2929
test_that("simple c", {
30-
res <- ds.abs("D$LAB_TSC", newobj = "abs.newobj")
31-
32-
expect_true(is.null(res))
30+
expect_silent(ds.abs("D$LAB_TSC", newobj = "abs.newobj"))
3331

3432
res.length <- ds.length("abs.newobj")
3533

tests/testthat/test-smk-ds.asCharacter.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ test_that("setup", {
2727

2828
# context("ds.asCharacter::smk::simple test")
2929
test_that("simple test", {
30-
ds.asCharacter("D$LAB_TSC")
30+
expect_silent(ds.asCharacter("D$LAB_TSC"))
3131

3232
res.class <- ds.class("ascharacter.newobj")
3333
expect_equal(res.class$sim1, "character")

tests/testthat/test-smk-ds.asDataMatrix.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ test_that("setup", {
2727

2828
# context("ds.asDataMatrix::smk::simple test")
2929
test_that("simple test", {
30-
ds.asDataMatrix(x.name="D$GENDER")
30+
expect_silent(ds.asDataMatrix(x.name="D$GENDER"))
3131

3232
res.class <- ds.class("asdatamatrix.newobj")
3333
expect_length(res.class, 3)

tests/testthat/test-smk-ds.asInteger.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ test_that("setup", {
2727

2828
# context("ds.asInteger::smk::simple test")
2929
test_that("simple test", {
30-
ds.asInteger("D$GENDER")
30+
expect_silent(ds.asInteger("D$GENDER"))
3131

3232
res.class <- ds.class("asinteger.newobj")
3333
expect_equal(res.class$sim1, "integer")

tests/testthat/test-smk-ds.asList.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ test_that("setup", {
2727

2828
# context("ds.asList::smk::simple test")
2929
test_that("simple test", {
30-
ds.asList(x.name="D$GENDER")
30+
expect_silent(ds.asList(x.name="D$GENDER"))
3131

3232
res.class <- ds.class("aslist.newobj")
3333
expect_equal(res.class$sim1, "list")

tests/testthat/test-smk-ds.asLogical.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ test_that("setup", {
2727

2828
# context("ds.asLogical::smk::simple test")
2929
test_that("simple test", {
30-
ds.asLogical("D$LAB_TSC")
30+
expect_silent(ds.asLogical("D$LAB_TSC"))
3131

3232
res.class <- ds.class("aslogical.newobj")
3333
expect_equal(res.class$sim1, "logical")

tests/testthat/test-smk-ds.asMatrix.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ test_that("setup", {
2727

2828
# context("ds.asMatrix::smk::simple test")
2929
test_that("simple test", {
30-
ds.asMatrix(x.name="D$GENDER")
30+
expect_silent(ds.asMatrix(x.name="D$GENDER"))
3131

3232
res.class <- ds.class("asmatrix.newobj")
3333
expect_true("matrix" %in% res.class$sim1)

tests/testthat/test-smk-ds.asNumeric.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ test_that("setup", {
2727

2828
# context("ds.asNumeric::smk::simple test")
2929
test_that("simple test", {
30-
ds.asNumeric("D$GENDER")
30+
expect_silent(ds.asNumeric("D$GENDER"))
3131

3232
res.class <- ds.class("asnumeric.newobj")
3333
expect_equal(res.class$sim1, "numeric")

tests/testthat/test-smk-ds.exp.R

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,7 @@ test_that("setup", {
2727

2828
# context("ds.exp::smk")
2929
test_that("simple exp", {
30-
res1 <- ds.exp("D$LAB_TSC", newobj="exp1_obj")
31-
32-
expect_length(res1, 0)
33-
34-
res1_exists <- ds.exists("exp1_obj")
35-
36-
expect_length(res1_exists, 3)
37-
expect_length(res1_exists$sim1, 1)
38-
expect_equal(res1_exists$sim1, TRUE)
39-
expect_length(res1_exists$sim2, 1)
40-
expect_equal(res1_exists$sim2, TRUE)
41-
expect_length(res1_exists$sim3, 1)
42-
expect_equal(res1_exists$sim3, TRUE)
30+
expect_silent(ds.exp("D$LAB_TSC", newobj="exp1_obj"))
4331

4432
res1_class <- ds.class("exp1_obj")
4533

@@ -53,21 +41,9 @@ test_that("simple exp", {
5341

5442
res_as <- ds.asInteger("D$LAB_TSC", newobj="new_data")
5543

56-
res2 <- ds.exp("new_data", newobj="exp2_obj")
57-
58-
expect_length(res2, 0)
59-
60-
res2_exists <- ds.exists("exp2_obj")
61-
62-
expect_length(res2_exists, 3)
63-
expect_length(res2_exists$sim1, 1)
64-
expect_equal(res2_exists$sim1, TRUE)
65-
expect_length(res2_exists$sim2, 1)
66-
expect_equal(res2_exists$sim2, TRUE)
67-
expect_length(res2_exists$sim3, 1)
68-
expect_equal(res2_exists$sim3, TRUE)
44+
expect_silent(ds.exp("new_data", newobj="exp2_obj"))
6945

70-
res2_class <- ds.class("exp1_obj")
46+
res2_class <- ds.class("exp2_obj")
7147

7248
expect_length(res2_class, 3)
7349
expect_length(res2_class$sim1, 1)

tests/testthat/test-smk-ds.log.R

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,7 @@ test_that("setup", {
2727

2828
# context("ds.log::smk")
2929
test_that("simple log", {
30-
res1 <- ds.log("D$LAB_TSC", newobj="log1_obj")
31-
32-
expect_length(res1, 0)
33-
34-
res1_exists <- ds.exists("log1_obj")
35-
36-
expect_length(res1_exists, 3)
37-
expect_length(res1_exists$sim1, 1)
38-
expect_equal(res1_exists$sim1, TRUE)
39-
expect_length(res1_exists$sim2, 1)
40-
expect_equal(res1_exists$sim2, TRUE)
41-
expect_length(res1_exists$sim3, 1)
42-
expect_equal(res1_exists$sim3, TRUE)
30+
expect_silent(ds.log("D$LAB_TSC", newobj="log1_obj"))
4331

4432
res1_class <- ds.class("log1_obj")
4533

@@ -53,19 +41,7 @@ test_that("simple log", {
5341

5442
res_as <- ds.asInteger("D$LAB_TSC", newobj="new_data")
5543

56-
res2 <- ds.log("new_data", newobj="log2_obj")
57-
58-
expect_length(res2, 0)
59-
60-
res2_exists <- ds.exists("log2_obj")
61-
62-
expect_length(res2_exists, 3)
63-
expect_length(res2_exists$sim1, 1)
64-
expect_equal(res2_exists$sim1, TRUE)
65-
expect_length(res2_exists$sim2, 1)
66-
expect_equal(res2_exists$sim2, TRUE)
67-
expect_length(res2_exists$sim3, 1)
68-
expect_equal(res2_exists$sim3, TRUE)
44+
expect_silent(ds.log("new_data", newobj="log2_obj"))
6945

7046
res2_class <- ds.class("log2_obj")
7147

0 commit comments

Comments
 (0)