Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ jobs:
set -euo pipefail
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
p7zip-full ffmpeg poppler-utils inkscape python3-pil
p7zip-full ffmpeg poppler-utils inkscape python3-pil python3-yaml

# The distribution's Pillow cannot open an AVIF - measured on this
# runner, PIL.UnidentifiedImageError on a file the structural checker
Expand Down
33 changes: 30 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ because it turns other people's test suites red.
used to start on whichever preset came first alphabetically - so what you
saw when you opened the tab changed whenever a preset was added. A preset
says now whether it is the one to start on, and `empty-and-minimal` is it:
pressing Generate without touching anything writes 32 214 B rather than the
pressing Generate without touching anything writes 32 667 B rather than the
73 MB the size-boundaries defaults come to, and its set means something
without a number from you first.
- **A recipe this program writes for you reads like one written by hand.**
Expand Down Expand Up @@ -195,6 +195,33 @@ because it turns other people's test suites red.

### Added

- **Two more formats, both for configuration: `yaml` and `toml`.** A config
file at an exact size is what a size-limited upload is for a picture, and
neither format had a way to ask for one. Run `tfg formats` for all twenty
six, or `tfg formats yaml` for what one takes.

Both write records: a `records` block of entries carrying an id, a name, an
email, an amount, a flag, a list of tags, a nested address and a note. YAML
comes out in block style rather than flow style, so it reads like a YAML
file rather than like JSON with a different extension. TOML comes out as an
array of `[[records]]` tables.

**The smallest yaml is 241 B and the smallest toml is 212 B**, each one
whole record. An empty file is legal in both - and it stays something you
ask for by shape rather than by byte count, the same answer `json` gives
about an empty array.

**The label rides in a comment**, which is new: these are the first record
formats whose label sits inside the file without touching the data being
tested. `csv` and `json` label from the outside because an extra field
changes the very structure under test, and a comment is not data. Ask for a
file at exactly the minimum and there is no room for it beside a whole
record, so it is left out and the run says so.

**TOML takes no `encoding` or `bom` setting and says why rather than
calling it an unknown option.** TOML is UTF-8 by its own specification, and
both readers tested refuse a TOML file that opens with a byte order mark.

- **Three more presets: `upload-validation`, `text-encoding` and
`tabular-import`.** Run `tfg preset list` for all five, or
`tfg preset show <id>` for what one takes and what it would produce before
Expand Down Expand Up @@ -246,8 +273,8 @@ because it turns other people's test suites red.
- **A second preset: `empty-and-minimal`.** It answers "does a file that is
valid and as small as the format allows get through?" and builds the
smallest legal file of every format this build has, plus a file of nought
bytes for every format that has a legal empty form. The whole set is 26
files and 32 214 B, so it checks twenty-four paths through your reader for
bytes for every format that has a legal empty form. The whole set is 28
files and 32 667 B, so it checks twenty-six paths through your reader for
the price of thirty-two kilobytes. Run it with `tfg generate --preset
empty-and-minimal`, or pick it on the Presets screen.

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,15 @@ reference is below it.

## πŸ“ Formats it generates

Twenty four, and every one is a **real file of that format** - it opens in the
Twenty six, and every one is a **real file of that format** - it opens in the
software that owns it, at the exact size you asked for:

| group | formats |
|---|---|
| πŸ“„ **Documents** | `pdf`, `docx` (Word), `xlsx` (Excel), `pptx` (PowerPoint) |
| πŸ–ΌοΈ **Images** | `png`, `jpg`, `bmp`, `gif`, `ico`, `svg`, `tiff`, `webp`, `avif`, `jxl` |
| πŸ“ **Text and markup** | `txt`, `md`, `csv`, `json`, `xml`, `html`, `log` |
| βš™οΈ **Configuration** | `yaml`, `toml` |
| πŸ—œοΈ **Archives** | `zip`, `targz` (`.tar.gz`) |
| πŸ”Š **Audio** | `wav` |

Expand Down Expand Up @@ -555,6 +556,7 @@ recipe. `tfg formats <id>` prints the allowed range or list for each:
| `json` | `formatting` |
| `svg` | `width`, `height` |
| `html` | `structure` |
| `yaml`, `toml` | none in this build - the document is a fixed shape, and a size is the only thing to ask for |

```
tfg generate --format jpg --size 500kb --set width=1920 --set height=1080 --set quality=85
Expand Down
2 changes: 2 additions & 0 deletions internal/format/all/all.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ import (
_ "github.com/donislawdev/TestingFilesGenerator/internal/format/svgfile"
_ "github.com/donislawdev/TestingFilesGenerator/internal/format/targz"
_ "github.com/donislawdev/TestingFilesGenerator/internal/format/tiff"
_ "github.com/donislawdev/TestingFilesGenerator/internal/format/tomlfile"
_ "github.com/donislawdev/TestingFilesGenerator/internal/format/txt"
_ "github.com/donislawdev/TestingFilesGenerator/internal/format/wav"
_ "github.com/donislawdev/TestingFilesGenerator/internal/format/webp"
_ "github.com/donislawdev/TestingFilesGenerator/internal/format/xlsx"
_ "github.com/donislawdev/TestingFilesGenerator/internal/format/xmlfile"
_ "github.com/donislawdev/TestingFilesGenerator/internal/format/yamlfile"
_ "github.com/donislawdev/TestingFilesGenerator/internal/format/zip"
)
Loading
Loading