Skip to content

Commit d1d4b8d

Browse files
committed
Unit test for Rcpp::wrap(std::string_view)
1 parent ad799af commit d1d4b8d

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

inst/tinytest/cpp/wrap.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,3 +304,10 @@ SEXP vector_Foo(){
304304
vec[1] = Foo( 3 ) ;
305305
return wrap(vec) ;
306306
}
307+
308+
// [[Rcpp::plugins(cpp17)]]
309+
// [[Rcpp::export]]
310+
SEXP test_wrap_string_view(){
311+
std::string_view sv = "test string value";
312+
return wrap(sv);
313+
}

inst/tinytest/test_wrap.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,6 @@ expect_equal(sapply( vector_Foo(), function(.) .$get() ), c(2, 3),
132132

133133
# test.wrap.custom.class <- function() {
134134
expect_equal(test_wrap_custom_class(), 42)
135+
136+
# test.wrap.custom.string_view <- function() {
137+
expect_equal(test_wrap_string_view(), "test string value")

0 commit comments

Comments
 (0)