File: check_cassette_names.Rd

package info (click to toggle)
r-cran-vcr 0.6.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,360 kB
  • sloc: cpp: 15; sh: 13; makefile: 2
file content (50 lines) | stat: -rw-r--r-- 2,062 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/check_cassette_names.R
\name{check_cassette_names}
\alias{check_cassette_names}
\title{Check cassette names}
\usage{
check_cassette_names(pattern = "test-", behavior = "stop")
}
\arguments{
\item{pattern}{(character) regex pattern for file paths to check.
this is done inside of \verb{tests/testthat/}. default: "test-"}

\item{behavior}{(character) "stop" (default) or "warning". if "warning",
we use \code{immediate.=TRUE} so the warning happens at the top of your
tests rather than you seeing it after tests have run (as would happen
by default)}
}
\description{
Check cassette names
}
\details{
This function is meant to be run during your tests, from a
\code{setup-pkgname.R} file inside the \code{tests/testthat} directory. It only
checks that cassette names are not duplicated. A helper function
\code{check_cassette_name()} runs inside \code{\link[=insert_cassette]{insert_cassette()}} that checks
that cassettes do not have: spaces, file extensions, unaccepted
characters (slashes)
}
\section{Cassette names}{

\itemize{
\item Should be meaningful so that it's obvious to you what test/function
they relate to. Meaningful names are important so that you can quickly
determine to what test file or test block a cassette belongs. Note that
vcr cannot check that your cassette names are meaningful.
\item Should not be duplicated. Duplicated cassette names would lead to
a test using the wrong cassette.
\item Should not have spaces. Spaces can lead to problems in using file paths.
\item Should not include a file extension. vcr handles file extensions for
the user.
\item Should not have illegal characters that can lead to problems in using
file paths: '/', '?', '<', '>', '\\', ':', '*', '|', and '\"'
\item Should not have control characters, e.g., \verb{\\n}
\item Should not have just dots, e.g., \code{.} or \code{..}
\item Should not have Windows reserved words, e.g., \code{com1}
\item Should not have trailing dots
\item Should not be longer than 255 characters
}
}