Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions tests/testthat/_snaps/attributes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# with_vertex_

Code
make_(from_literal(A - A:B:C, B - A:B:C), with_vertex_(color = 1:2))
Condition
Error in `i_set_vertex_attr()`:
! Length of new attribute value must be 1 or 3, the number of target vertices, not 2.

# with_edge_

Code
make_(from_literal(A - A:B:C, B - A:B:C), with_edge_(color = 1:2))
Condition
Error in `i_set_edge_attr()`:
! Length of new attribute value must be 1 or 3, the number of target edges, not 2.

# error messages work

Code
Expand Down
10 changes: 10 additions & 0 deletions tests/testthat/test-attributes.R
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,11 @@ test_that("with_vertex_", {
expect_identical_graphs(g1, g2)
expect_equal(V(g2)$color, rep("red", gorder(g2)))
expect_equal(V(g2)$foo, paste0("xx", 1:3))

expect_snapshot(
make_(from_literal(A - A:B:C, B - A:B:C), with_vertex_(color = 1:2)),
error = TRUE
)
})


Expand All @@ -398,6 +403,11 @@ test_that("with_edge_", {
expect_identical_graphs(g1, g2)
expect_equal(E(g1)$color, E(g2)$color)
expect_equal(E(g1)$foo, E(g2)$foo)

expect_snapshot(
make_(from_literal(A - A:B:C, B - A:B:C), with_edge_(color = 1:2)),
error = TRUE
)
})


Expand Down