tasty-sugar-2.2.2.1: Tests defined by Search Using Golden Answer References
Safe HaskellNone
LanguageHaskell2010

Test.Tasty.Sugar.Candidates

Description

This module provides management for tracking candidate files that might be a root file, an expected file, or an associated file.

Synopsis

Documentation

candidateToPath :: CandidateFile -> FilePath Source #

This converts a CandidateFile into a regular FilePath for access by standard IO operations.

findCandidates :: CUBE -> FilePath -> IO [Either String CandidateFile] Source #

Given a CUBE and a target directory, find all files in that directory and subdirectories that could be candidates for processing with tasty-sugar. Each file is turned into a candidate via the makeCandidate function.

makeCandidate :: CUBE -> FilePath -> [String] -> FilePath -> CandidateFile Source #

Create a CandidateFile entry for this top directory, sub-paths, and filename. In addition, any Explicit parameters with known values that appear in the filename are captured. Note that:

  • There may be multiple possible matches for a single parameter (e.g. the value is repeated in the name or path, or an undefind value (Nothing) parameter could have multiple possible values extracted from the filename.
  • File name matches are preferred over sub-path matches and will occlude the latter.
  • All possible filename portions and sub-paths will be suggested for non-value
  • parameters (validParams with Nothing).

candidateMatchPrefix :: Separators -> CandidateFile -> CandidateFile -> Bool Source #

Determines if the second CandidateFile argument matches the prefix of the first CandidateFile, up to any separator (if applicable). This can be used to match possible expected files against the current root file, or possible associated files against the current expected file.

candidateMatchSuffix :: Separators -> FileSuffix -> CandidateFile -> CandidateFile -> Bool Source #

Determines if the second candidate file matches the first by virtue of having the same identified suffix. If a non-null suffix is specified then verify the second file is the conjunction of the first file with a separator and the specified suffix with appropriate considerations for any separator in the supplied suffix. If no suffix is provided, then simply ensure that the second file has no suffix.