Skip to content

Commit

Permalink
Merge pull request #52 from EmilHvitfeldt/printing-bug
Browse files Browse the repository at this point in the history
Fix printing bug for materialization
  • Loading branch information
EmilHvitfeldt authored May 13, 2024
2 parents 17f163c + 09b3c1b commit 9341dd7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/altrep-sparse-double.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const void* altrep_sparse_double_Dataptr_or_null(SEXP x) {
if (out == R_NilValue) {
return NULL;
} else {
return out;
return STDVEC_DATAPTR(out);
}
}

Expand Down
7 changes: 7 additions & 0 deletions tests/testthat/_snaps/altrep.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,3 +268,10 @@
sparsevctrs: Sparse vector materialized
[1] 1

# printing works #48

Code
sparse_double(1, 1, 10) + 1
Output
[1] 2 1 1 1 1 1 1 1 1 1

6 changes: 6 additions & 0 deletions tests/testthat/test-altrep.R
Original file line number Diff line number Diff line change
Expand Up @@ -444,3 +444,9 @@ test_that("verbose testing", {
)
})

test_that("printing works #48", {
expect_snapshot(
sparse_double(1, 1, 10) + 1
)
})

0 comments on commit 9341dd7

Please sign in to comment.