Utility for testing a program that runs file operations.
  • TypeScript 84.7%
  • Shell 15.3%
Find a file
2026-09-04 23:22:19 +02:00
example init 2026-09-04 22:17:47 +02:00
package add packaging 2026-09-04 22:25:40 +02:00
src add capture of output of the scenario 2026-09-04 23:22:19 +02:00
.gitignore init 2026-09-04 22:17:47 +02:00
build fixes execution stopping on ill formed cases 2026-09-04 23:03:33 +02:00
deno.json init 2026-09-04 22:17:47 +02:00
deno.lock init 2026-09-04 22:17:47 +02:00
filecase.ts add capture of output of the scenario 2026-09-04 23:22:19 +02:00
LICENSE init 2026-09-04 22:17:47 +02:00
README.md add capture of output of the scenario 2026-09-04 23:22:19 +02:00
VERSION init 2026-09-04 22:17:47 +02:00

Filecase

Utility for testing a program that runs file operations.

Usage

filecase --help

# filecase 1.0.0 - Utility for testing a program that runs file operations.
# Usage :
#         filecase [options...] <suites...>
# 
# Options :
#         -h, --help   Prints this message.
#         --version    Prints the version of this software.
#         -c, --capture  Captures stdout and stderr from the scenario.
# 
# Description :
#         Runs a set of test suites, each suite contains test cases. They are
#         composed of a workdir directory, a scenario executable and an expects
#         directory.
# 
#         While a test is run, the workdir is copied to a temporary directory, the
#         scenario is ran with the current working dirrectory being set inside this
#         temporary directory. Finally, the content of the temporary directory is
#         compared with the content of the expects directory.
# 
#         A test case fails if the scenario fails at some point or if there are
#         differences between the temporary directory and the expected directory
#         after the execution of the scenario.

Example

terminal output from running filecase on the example folder

Design

This program runs all cases in the suites given as arguments, reporting test case failures and summarizing overall success.

Suite

A test suite is a directory containing test cases. The name of the directory is the name of the test suite.

Case

A case is a directory containing :

  • ./scenario An executable that performs some file operations.
  • ./workdir/* A directory with the initial file state.
  • ./expects/* A directory with the expected result.

When a case is run, its ./workdir/ is copied to a temporary directory (tempdir/), then the scenario is run as a new process with its current working directory set to the tempdir/. Finally, the content of the tempdir/ is compared with the content of the ./expects/ directory.

A case fails if :

  • The execution of ./scenario has exited with a non-zero status code.
  • The content of tempdir/ differs from the content of ./expects/.

The name of the case is the name of the case directory.

Licensing

Copyright © 2026 Matthieu Jolimaitre. Licensed under the EUPL