Skip to content
Novus Examples
diff1.3 KB

Unified Diff - Three Files in One Stream

Three unrelated files changed in a single diff stream, with no `diff --git` lines to mark the boundaries — the only separator is the next `---` header. Splitters that key on `diff --git` see one file here instead of three.

Preview — first 44 linesdiff
--- a/README.md	2026-03-02 09:14:03.000000000 +0000
+++ b/README.md	2026-03-02 10:41:55.000000000 +0000
@@ -1,6 +1,6 @@
 # ledger-service
 
-A double-entry ledger with an HTTP posting API.
+A double-entry ledger with an HTTP posting API and a CSV import path.
 
 ## Running
 
--- a/scripts/release.sh	2026-03-02 09:14:03.000000000 +0000
+++ b/scripts/release.sh	2026-03-02 10:41:55.000000000 +0000
@@ -1,4 +1,5 @@
 #!/bin/sh
 set -eu
 VERSION="$1"
+test -n "$VERSION" || { echo "usage: release.sh <version>" >&2; exit 2; }
 echo "tagging $VERSION"
--- a/web/src/format.ts	2026-03-02 09:14:03.000000000 +0000
+++ b/web/src/format.ts	2026-03-02 10:41:55.000000000 +0000
@@ -1,9 +1,11 @@
 export interface Money {
   amount: number;
   currency: string;
+  locale?: string;
 }
 
 const GROUPING = 3;
+const DEFAULT_LOCALE = "en-GB";
 
 export function formatMinor(minor: number, currency: string): string {
   const sign = minor < 0 ? "-" : "";
@@ -33,5 +35,9 @@
 
 export function parseMinor(text: string): number {
   const cleaned = text.replace(/[^0-9-]/g, "");
-  return Number.parseInt(cleaned, 10);
+  const parsed = Number.parseInt(cleaned, 10);
+  if (Number.isNaN(parsed)) {
+    throw new RangeError("parseMinor: no digits in " + JSON.stringify(text));
+  }
+  return parsed;
 }

Specifications

Seed
20260807
Diff Format
unified
Context
3
Files
3
Hunks
4
Line Endings
LF
Encoding
UTF-8

Testing contract

Expected to pass
Scenario
Split a plain POSIX diff into per-file patches without any diff --git markers to key on.
Expected result
Three file sections are recovered: README.md, scripts/release.sh and web/src/format.ts, in that order.

What is a .diff file?

A .diff file records the difference between two versions of one or more text files. The unified format — the default almost everywhere — names the old and new files on `---` and `+++` lines, then lists hunks introduced by `@@ -old,count +new,count @@` in which context lines are unprefixed and changed lines are prefixed with `-` or `+`. Older context and normal diff formats exist but are rarely produced today.

How to use this file

Use an example .diff file to test diff parsers, syntax highlighters, and merge tooling — verifying hunk-offset arithmetic, correct handling of context lines that begin with a space, and behaviour on files whose changes include trailing-whitespace or line-ending differences.

How to use this file for testing

“Unified Diff - Three Files in One Stream” is a deterministic Novus Examples fixture for Visual diff / regression, Code parsing, Editor testing. A/B image twins with controlled pixel changes, anti-alias variants, and UI chrome crops for screenshot diff and visual regression tools.

Documented properties for this file: seed 20260807 · UTF-8 · LF. Compare results against paired or grouped companions on this page when present (clean↔damaged, searchable↔scanned, or format twins) so scores stay reproducible across runs.

Download the file once, keep the path stable in CI or local scripts, and treat the spec table as the contract: dimensions, seeds, field lists, and roles are intentional. Corrupt or invalid samples are labelled as such — expect parsers to fail loudly rather than silently accept them.

Diff and patch fixtures name their target paths and the exact edge case they exercise — rename, mode change, binary hunk, CRLF↔LF, or missing trailing newline. Apply or render them against the documented before-state; every author, path, and hash is fictional.

Treat A/B twins as a visual regression unit: run your pixel or perceptual diff, assert a non-zero delta on the changed twin, and keep thresholds calibrated against the documented change kind in specs.

Generated by generation/version_control.py. Free for any use, no attribution required — license.