Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/llvm-swift/filecheck
A standalone Swift version of LLVM's flexible pattern matching file verifier
https://github.com/llvm-swift/filecheck
Last synced: 4 days ago
JSON representation
A standalone Swift version of LLVM's flexible pattern matching file verifier
- Host: GitHub
- URL: https://github.com/llvm-swift/filecheck
- Owner: llvm-swift
- License: mit
- Created: 2017-03-10T01:35:46.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-03-17T23:40:28.000Z (over 2 years ago)
- Last Synced: 2024-10-21T03:45:28.281Z (23 days ago)
- Language: Swift
- Size: 109 KB
- Stars: 66
- Watchers: 6
- Forks: 10
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# FileCheck
[![Build Status](https://travis-ci.org/llvm-swift/FileCheck.svg?branch=master)](https://travis-ci.org/llvm-swift/FileCheck)A standalone Swift version of LLVM's flexible pattern matching file verifier
## Introduction
FileCheck is a utility for verifying the contents of two files match (for example,
one from standard input, and one residing on disk). This implementation of
FileCheck emphasizes its use as a tool for checking output generated by programs
against an expected set of strings that can be specified inline next to the
`print` statement that generated it.The primary API in this package is the `fileCheckOutput` function, which comes
with a number of convenient optional parameters to modify the behavior of the
verification process. For example, here is a self-contained test that verifies
the output of FizzBuzz:```swift
assert(fileCheckOutput(withPrefixes: ["FIZZBUZZ"]) {
for i in (1..<10) {
var out = ""
if i % 3 == 0 {
out += "Fizz"
}
if i % 5 == 0 {
out += "Buzz"
}
if out.isEmpty {
out += "\(i)"
}
// FIZZBUZZ: 1
// FIZZBUZZ-NEXT: 2
// FIZZBUZZ-NEXT: Fizz
// FIZZBUZZ-NEXT: 4
// FIZZBUZZ-NEXT: Buzz
// FIZZBUZZ-NEXT: Fizz
// FIZZBUZZ-NEXT: 7
// FIZZBUZZ-NEXT: 8
// FIZZBUZZ-NEXT: Fizz
print(out)
}
})
```Executing this test in any file will cause FileCheck to read it in
from disk and verify the output of the program against the check-strings in the
comments.## Setup
**Using The Swift Package Manager**
- Add FileCheck to your `Package.swift` file's dependencies section:
```swift
.package(url: "https://github.com/llvm-swift/FileCheck.git", "0.0.1"..."1.0.0")
```## Authors
- Harlan Haskins ([@harlanhaskins](https://github.com/harlanhaskins))
- Robert Widmann ([@CodaFi](https://github.com/CodaFi))## License
This project is released under the MIT license, a copy of which is available in this repo.