Skip to content

Commit

Permalink
Improve test suite for bibtex (#46)
Browse files Browse the repository at this point in the history
* Upgrade testing suite to testthat 3

* Add testing for previous issues

#45

* Add tests for standard bibtex entries

As defined in BibTEX version 0.99b
https://ctan.javinator9889.com/biblio/bibtex/base/btxdoc.pdf

* Update actions

* Add testing for examples

* Add snapshots for examples read.bib This may fail on some platforms

* Skip on non windows

Possibly a character problem related with
#20 and
#43

* Not test on R 3.4

Some changes in default  parsing (snapshot), but results are still ok

* Add more tests

* Try to increase coverage

* One more tests for do_read_bib

* Fix test for do_read_bib

* Revert actions

* Add devtools for testing

* Add more tests

* Add test for multiline string

* Add non standard field names

* Add myself as author

* Move issues to inst/bib files

* Refactor tests for avoiding cluttering
  • Loading branch information
dieghernan committed Jan 13, 2022
1 parent 1c0e12d commit 05a401c
Show file tree
Hide file tree
Showing 45 changed files with 6,291 additions and 43 deletions.
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ revdep
^_pkgdown\.yml$
^docs$
^pkgdown$
^bibtex\.Rcheck$
^bibtex.*\.tar\.gz$
^bibtex.*\.tgz$
13 changes: 12 additions & 1 deletion .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ jobs:
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel/1'}
- {os: ubuntu-latest, r: 'oldrel/2'}
# Use 3.6 to trigger usage of RTools35
- {os: windows-latest, r: '3.6'}
# Use older ubuntu to maximise backward compatibility
- {os: ubuntu-18.04, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-18.04, r: 'release'}
- {os: ubuntu-18.04, r: 'oldrel-1'}
- {os: ubuntu-18.04, r: 'oldrel-2'}


env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -41,7 +50,9 @@ jobs:

- uses: r-lib/actions/setup-r-dependencies@v1
with:
extra-packages: rcmdcheck
extra-packages: |
rcmdcheck
devtools
- name: Check
env:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ jobs:

- uses: r-lib/actions/setup-r-dependencies@v1
with:
extra-packages: covr
extra-packages: |
covr
devtools
- name: Test coverage
run: covr::codecov()
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ src/*.so
src/*.dll
bibtex.Rproj
docs
bibtex.Rcheck/
bibtex*.tar.gz
bibtex*.tgz
10 changes: 8 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ Authors@R: c(
role = c("ctb", "cre"),
email = "balamut2@illinois.edu",
comment = c(ORCID = "0000-0003-2826-8458")),
person(given = "Diego",
family = "Hernangómez",
role = c("aut"),
email = "diego.hernangomezherrero@gmail.com",
comment = c(ORCID = "0000-0001-8457-4658")),
person(given = "Scott",
family = "Chamberlain",
role = c("ctb"),
Expand Down Expand Up @@ -47,7 +52,8 @@ Depends:
Imports:
utils
Suggests:
testthat
testthat (>= 3.0.0)
LazyLoad: yes
Encoding: UTF-8
RoxygenNote: 7.1.1
RoxygenNote: 7.1.2
Config/testthat/edition: 3
6 changes: 6 additions & 0 deletions inst/bib/issue15.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@Article{newspaper,
author = {Author Smith},
title = {Article title},
date = {2016-12-21},
journal = {Newspaper name},
}
6 changes: 6 additions & 0 deletions inst/bib/issue17.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@Article{newspaper,
author = {{Herm{\`e}s International S.A.} and Katzfu{\ss}, Matthias},
title = {Article title},
date = {2016-12-21},
journal = {Newspaper name}
}
13 changes: 13 additions & 0 deletions inst/bib/issue18.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@Article{10.1371/journal.pone.0109458,
author = {Liu, Yang-Yu AND Nacher, Jose C. AND Ochiai, Tomoshiro AND Martino, Mauro AND Altshuler, Yaniv},
journal = {PLOS ONE},
publisher = {Public Library of Science},
title = {Prospect Theory for Online Financial Trading},
year = {2014},
month = {10},
volume = {9},
url = {https://doi.org/10.1371/journal.pone.0109458},
pages = {1-7},
number = {10},
doi = {10.1371/journal.pone.0109458}
}
10 changes: 10 additions & 0 deletions inst/bib/issue23.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@article{Hawking1966,
author = {Hawking, Stephen William and Bondi, Hermann },
title = {The occurrence of singularities in cosmology},
journal = {Proceedings of the Royal Society of London. Series A. Mathematical and Physical Sciences},
volume = {294},
number = {1439},
pages = {511-521},
year = {1966},
doi = {10.1098/rspa.1966.0221},
}
7 changes: 7 additions & 0 deletions inst/bib/issue6.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@Article{newspaper,
author = {Van Damme, Jean-Claude},
title = {Article title},
date = {2016-12-21},
journal = {Newspaper name},
year = {2016},
}
7 changes: 7 additions & 0 deletions inst/bib/issue7.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@Article{newspaper,
author = {Jean-Claude {Van Damme}},
title = {Article title},
date = {2016-12-21},
journal = {Newspaper name},
year = {2016},
}
5 changes: 5 additions & 0 deletions inst/bib/issue9.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@Misc{key?,
author = "Smith, Bob",
title = "The Title",
year = 2012
}
22 changes: 22 additions & 0 deletions inst/bib/multiline_string.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@String{inst-CS-U-MARYLAND = "Department of Computer Science,
University of Maryland"}


@TechReport{Golub:1976:RDLb,
author = "G. H. Golub and Virginia Klema and G. W. {Stewart
III}",
title = "Rank Degeneracy and Least Squares Problems",
type = "Report",
number = "TR-751",
institution = inst-CS-U-MARYLAND,
pages = "????",
month = "????",
year = "1976",
bibdate = "Thu May 29 16:12:45 2014",
bibsource = "http://www.math.utah.edu/pub/bibnet/authors/g/golub-gene-h.bib;
http://www.math.utah.edu/pub/bibnet/authors/s/stewart-gilbert-w.bib",
acknowledgement = ack-nhfb,
GWSnumber = "N6",
xxnote = "Check: is this the same as Golub:1976:RDLa? If so,
which report number is correct??",
}
10 changes: 10 additions & 0 deletions inst/bib/unable_recover_42.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@String{{BAZ = "Foo Bar Baz" }

@misc{murdoch:2009,
author = "Duncan Murdoch",
title = "Parsing Rd files",
year = 2009,
institution = BAZ,
url = "http://developer.r-project.org/parseRd.pdf"
}

15 changes: 15 additions & 0 deletions inst/bib/unbalanced_braces.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@misc{murdoch:2009,
author = "Duncan Murdoch",
title = "Parsing Rd files",
year = 2009,
url = "http://developer.r-project.org/parseRd.pdf"
}


@misc{murdoch:2010,
author = "Duncan Murdoch",
title = {"Parsing {Rd} files unbalanced",
year = 2010,
url = "http://developer.r-project.org/parseRd.pdf"
}

57 changes: 57 additions & 0 deletions inst/bib/xampl_message.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
% Copyright (C) 1988, 2010 Oren Patashnik.
% Unlimited copying and redistribution of this file are permitted if it
% is unmodified. Modifications (and their redistribution) are also
% permitted, as long as the resulting file is renamed.
% Source: https://tug.org/texmf-docs/bibtex/xampl.bib
@ARTICLE{article-full,
author = {L[eslie] A. Aamport},
title = {The Gnats and Gnus Document Preparation System},
journal = {\mbox{G-Animal's} Journal},
year = 1986,
volume = 41,
number = 7,
pages = "73+",
month = jul,
note = "This is a full ARTICLE entry",
}

@BOOK{book-full,
author = "Donald E. Knuth",
title = "Seminumerical Algorithms",
volume = 2,
series = "The Art of Computer Programming",
publisher = "Addison-Wesley",
address = "Reading, Massachusetts",
edition = "Second",
month = "10~" # jan,
year = "{\noopsort{1973c}}1981",
note = "This is a full BOOK entry",
}

@BOOKLET{booklet-full,
author = "Jill C. Knvth",
title = "The Programming of Computer Art",
howpublished = "Vernier Art Center",
address = "Stanford, California",
month = feb,
year = 1988,
note = "This is a full BOOKLET entry",
}

@CONFERENCE{conference-full,
author = "Alfred V. Oaho and Jeffrey D. Ullman and Mihalis Yannakakis",
title = "On Notions of Information Transfer in {VLSI} Circuits",
editor = "Wizard V. Oz and Mihalis Yannakakis",
booktitle = "Proc. Fifteenth Annual ACM",
number = 17,
series = "All ACM Conferences",
pages = "133--139",
month = mar,
year = 1983,
address = "Boston",
organization = ACM,
publisher = "Academic Press",
note = "This is a full CONFERENCE entry",
}
Loading

0 comments on commit 05a401c

Please sign in to comment.