# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. test_that("as_nanoarrow_vctr() works for basic input", { array <- as_nanoarrow_array(c("one", "two")) vctr <- as_nanoarrow_vctr(array) expect_identical(as.integer(unclass(vctr)), 1:2) expect_identical(as_nanoarrow_vctr(vctr), vctr) expect_identical(infer_nanoarrow_schema(vctr)$format, "u") expect_identical(as_nanoarrow_schema(vctr)$format, "u") }) test_that("print() and str() work on empty nanoarrow_vctr", { vctr <- nanoarrow_vctr() expect_identical( expect_output(print(vctr),">"), vctr ) expect_identical( expect_output(str(vctr), ">"), vctr ) vctr <- nanoarrow_vctr(na_int32()) expect_identical( expect_output(print(vctr), "^