DEV Community

boB Rudis
boB Rudis

Posted on • Originally published at on

Two New Testing-themed Addins + One New and One Updated CRAN Package


It’s been yet-another weirdly busy summer but I’m finally catching up on noting some recent-ish developments in the blog.

First up is a full rewrite of the {wand} pacakge which still uses magic but is 100% R code (vs a mix of compiled C and R code) and now works on Windows. A newer version will be up on CRAN in a bit that has additional MIME mappings and enables specifying a custom extension mapping data frame. You’ve seen this beast on the blog before, though, by another name.

## [1] "text/plain"

Enter fullscreen mode Exit fullscreen mode

Next is the {ulid} package (which I’ve also previously discussed, here) which is also now on CRAN to meet all your Universally Unique Lexicographically Sortable Identifiers-generation needs.


## ts rnd
## 1 2019-07-27 08:27:56 RSVA4ACSCQJA61A0

Enter fullscreen mode Exit fullscreen mode

The [{testthat}] gravity well has caught over 4,000 CRAN packages but it’s not the only testing game in town. The {tinytest} package take slightly more minimalist approach and has the added benefit that the tests come along for the ride with the package, which makes it easier to solicit said test results from package users having problems with your code.

I still use {testthat} in most of my packages but gave {tinytest} a spin for a few of my more recent ones and it’s pretty nifty. The biggest feature I missed when switching to it was the lack of Cmd-Shift-T support for it in RStudio. Since I kinda still want Cmd-Shift-T for all the packages I have that use {testthat} I whipped up an RStudio addin that adds an Addin context menu item (below) and placed it in {hrbraddins}.

If you load up that package you can then bind something like Cmd-Option-Shift-T to that function and have equally quick keystroke access to package tests during development.

> hrbraddins:::run_tiny_test() # from within the {wand} pkg
Running test_wand.R................... 52 tests OK
All ok (52 results)

Enter fullscreen mode Exit fullscreen mode

Finally, I got bit in a recent CRAN submission because I have remote CRAN checks turned off (soooo sloooowww) but had a 404’ing URL in the documentation of one of the methods in the package. Since I have a few more submissions coming up in the next 6-8 weeks I decided to whip up an RStudio addin for an on-the-fly package URL checker that wraps the exact same checks CRAN does for these submissions. (I keybound this to Cmd-Option-Shift-U and you can catch a glimpse of it in the addins menu in the above screenshot).

The output of one run is below. I deliberately modified two working URLs to show what you get output-wise when everything isn’t perfect:

> hrbraddins:::check_package_urls()
Gathering URLs for {wand} (this may take a bit)
- Looking in HTML files...
- Looking in metadata files...
- Looking in news files...
- Looking in Rd files...
- Looking in README files...
- Looking in source files...
- Looking in PDF files...

Checking found URLs (this may also take a bit)
# A tibble: 13 x 4
   url parent status is_https
   <chr> <chr> <dbl> <lgl>   
 3 man/wand.Rd 200 TRUE    
 4 man/wand.Rd 200 TRUE    
 5 200 TRUE    
 6 200 TRUE    
 7 200 TRUE    
 8 200 TRUE    
 9 200 TRUE    
10 200 TRUE    
11 200 TRUE    
12 200 TRUE    
13 200 TRUE  

Enter fullscreen mode Exit fullscreen mode

The {hrbraddins} package itself is just a playground and will never see CRAN, so do not hesitate to yank anything from it and put it in a safer and/or more accessible location for your own work.


For the packages, file issues and PRs the same way you always would. Same goes for the addins.

Top comments (0)