From a66076aff40704a79931463f0a1dc92993a4b6e2 Mon Sep 17 00:00:00 2001 From: SymbolixAU Date: Wed, 13 May 2020 14:13:03 +1000 Subject: [PATCH] tests for #83 --- tests/testthat/test-sf.R | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/testthat/test-sf.R b/tests/testthat/test-sf.R index 395d3be..452c254 100644 --- a/tests/testthat/test-sf.R +++ b/tests/testthat/test-sf.R @@ -468,3 +468,22 @@ test_that("different property types work",{ # sf_point( obj = df[0, ], x = "x", y = "y", keep = TRUE ) }) + +test_that("ids returned correctly - issue 83",{ + + df <- data.frame( + x = 1:5 + , y = 1:5 + , my_id = 1 + ) + + expect_true( all( names( sf_multipoint(df, multipoint_id = "my_id") ) == c("my_id", "geometry") ) ) + expect_true( all( names( sf_linestring(df, linestring_id = "my_id") ) == c("my_id", "geometry") ) ) + expect_true( all( names( sf_polygon(df, polygon_id = "my_id") ) == c("my_id", "geometry") ) ) + expect_true( all( names( sf_multipolygon(df, multipolygon_id = "my_id") ) == c("my_id", "geometry") ) ) + +}) + + + +