Browse Source

appveyor and more tests

pull/13/merge
boB Rudis 6 years ago
parent
commit
a04b8009af
No known key found for this signature in database GPG Key ID: 2A514A4997464560
  1. 2
      .Rbuildignore
  2. 9
      .travis.yml
  3. 3
      DESCRIPTION
  4. 4
      README.Rmd
  5. 45
      appveyor.yml
  6. 1
      codecov.yml
  7. 29
      tests/testthat/test-docxtractr.R

2
.Rbuildignore

@ -7,3 +7,5 @@
^README\.md$
^docxtractr-logo\.png$
^cran-comments\.md$
^appveyor\.yml$
^codecov\.yml$

9
.travis.yml

@ -1,5 +1,6 @@
# Sample .travis.yml for R projects
language: R
sudo: false
cache: packages
language: r
warnings_are_errors: true
sudo: required
after_success:
- Rscript -e 'covr::codecov()'

3
DESCRIPTION

@ -17,7 +17,8 @@ Depends:
License: MIT + file LICENSE
LazyData: true
Suggests:
testthat
testthat,
covr
Imports:
tools,
xml2,

4
README.Rmd

@ -12,7 +12,9 @@ knitr::opts_chunk$set(
)
```
[![Travis-CI Build Status](https://travis-ci.org/hrbrmstr/docxtractr.svg?branch=master)](https://travis-ci.org/hrbrmstr/docxtractr) [![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/docxtractr)](http://cran.r-project.org/package=docxtractr)
[![Travis-CI Build Status](https://travis-ci.org/hrbrmstr/docxtractr.svg?branch=master)](https://travis-ci.org/hrbrmstr/docxtractr)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/hrbrmstr/docxtractr?branch=master&svg=true)](https://ci.appveyor.com/project/hrbrmstr/docxtractr)
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/docxtractr)](http://cran.r-project.org/package=docxtractr)
![](docxtractr-logo.png)

45
appveyor.yml

@ -0,0 +1,45 @@
# DO NOT CHANGE the "init" and "install" sections below
# Download script file from GitHub
init:
ps: |
$ErrorActionPreference = "Stop"
Invoke-WebRequest http://raw.github.com/krlmlr/r-appveyor/master/scripts/appveyor-tool.ps1 -OutFile "..\appveyor-tool.ps1"
Import-Module '..\appveyor-tool.ps1'
install:
ps: Bootstrap
cache:
- C:\RLibrary
# Adapt as necessary starting from here
build_script:
- travis-tool.sh install_deps
test_script:
- travis-tool.sh run_tests
on_failure:
- 7z a failure.zip *.Rcheck\*
- appveyor PushArtifact failure.zip
artifacts:
- path: '*.Rcheck\**\*.log'
name: Logs
- path: '*.Rcheck\**\*.out'
name: Logs
- path: '*.Rcheck\**\*.fail'
name: Logs
- path: '*.Rcheck\**\*.Rout'
name: Logs
- path: '\*_*.tar.gz'
name: Bits
- path: '\*_*.zip'
name: Bits

1
codecov.yml

@ -0,0 +1 @@
comment: false

29
tests/testthat/test-docxtractr.R

@ -3,6 +3,14 @@ test_that("we can do something", {
doc <- read_docx(system.file("examples/data.docx", package="docxtractr"))
x <- capture.output(print(doc))
x <- capture.output(docx_describe_tbls(doc))
expect_equal(length(docx_extract_all(doc)), 1)
expect_equal(length(docx_extract_all_tbls(doc)), 1)
expect_that(doc, is_a("docx"))
expect_that(docx_tbl_count(doc), equals(1))
expect_that(docx_extract_tbl(doc, 1), is_a("tbl"))
@ -22,4 +30,25 @@ test_that("we can do something", {
expect_that(ncol(tmp_4), equals(3))
expect_that(nrow(tmp_5), equals(6))
tmp_6 <- assign_colnames(tmp_5, 1)
expect_equal(colnames(tmp_6), c("Aa", "Bb", "Cc"))
cmnt <- read_docx(system.file("examples/comments.docx", package="docxtractr"))
expect_equal(docx_cmnt_count(cmnt), 3)
x <- capture.output(docx_describe_cmnts(cmnt))
x <- capture.output(print(cmnt))
expect_equal(nrow(docx_extract_all_cmnts(cmnt)), 3)
real_world <- read_docx(system.file("examples/realworld.docx", package="docxtractr"))
tbls <- docx_extract_all_tbls(real_world)
expect_equal(colnames(mcga(assign_colnames(tbls[[1]], 2))),
c("country", "birthrate", "death_rate", "population_growth_2005",
"population_growth_2050", "relative_place_in_transition", "social_factors_1",
"social_factors_2", "social_factors_3"))
})

Loading…
Cancel
Save