New Upstream Release - golang-github-bradleyjkemp-cupaloy

Ready changes

Summary

Merged new upstream version: 2.8.0 (was: 2.7.0).

Resulting package

Built on 2022-09-29T23:31 (took 3m29s)

The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:

apt install -t fresh-releases golang-github-bradleyjkemp-cupaloy-dev

Lintian Result

Diff

diff --git a/config.go b/config.go
index 811c49c..91e8079 100644
--- a/config.go
+++ b/config.go
@@ -76,6 +76,15 @@ func SnapshotFileExtension(snapshotFileExtension string) Configurator {
 	}
 }
 
+// DiffSnapshots allows you to change the diffing function used to display the
+// difference between the previous snapshot and the current.
+// Default: Internal differ using difflib
+func DiffSnapshots(differ func(previous, current string) string) Configurator {
+	return func(c *Config) {
+		c.diffSnapshots = differ
+  }
+}
+
 // UseStringerMethods invoke String() or Error() methods when available rather than dumping the object.
 // This should probably be disabled by default but is not for backwards compatibility reasons.
 // Default: true
@@ -93,6 +102,7 @@ type Config struct {
 	createNewAutomatically bool
 	fatalOnMismatch        bool
 	snapshotFileExtension  string
+	diffSnapshots          func(previous, current string) string
 	useStringerMethods     bool
 }
 
@@ -106,6 +116,7 @@ func NewDefaultConfig() *Config {
 		CreateNewAutomatically(true),
 		FatalOnMismatch(false),
 		SnapshotFileExtension(""),
+		DiffSnapshots(diffSnapshots),
 		UseStringerMethods(true),
 	)
 }
@@ -121,6 +132,7 @@ func (c *Config) clone() *Config {
 		createNewAutomatically: c.createNewAutomatically,
 		fatalOnMismatch:        c.fatalOnMismatch,
 		snapshotFileExtension:  c.snapshotFileExtension,
+		diffSnapshots:          c.diffSnapshots,
 		useStringerMethods:     c.useStringerMethods,
 	}
 }
diff --git a/cupaloy.go b/cupaloy.go
index 50964b7..cb704a0 100644
--- a/cupaloy.go
+++ b/cupaloy.go
@@ -133,6 +133,6 @@ func (c *Config) snapshot(snapshotName string, i ...interface{}) error {
 	}
 
 	return internal.ErrSnapshotMismatch{
-		Diff: diffSnapshots(prevSnapshot, snapshot),
+		Diff: c.diffSnapshots(prevSnapshot, snapshot),
 	}
 }
diff --git a/debian/changelog b/debian/changelog
index be07bf0..a292753 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+golang-github-bradleyjkemp-cupaloy (2.8.0-1) UNRELEASED; urgency=low
+
+  * New upstream release.
+
+ -- Debian Janitor <janitor@jelmer.uk>  Thu, 29 Sep 2022 23:28:17 -0000
+
 golang-github-bradleyjkemp-cupaloy (2.7.0-1) unstable; urgency=medium
 
   * New upstream release.
diff --git a/util.go b/util.go
index 57c8fd1..303a026 100644
--- a/util.go
+++ b/util.go
@@ -114,7 +114,7 @@ func (c *Config) updateSnapshot(snapshotName string, prevSnapshot string, snapsh
 		return nil
 	}
 
-	snapshotDiff := diffSnapshots(prevSnapshot, snapshot)
+	snapshotDiff := c.diffSnapshots(prevSnapshot, snapshot)
 
 	if isNewSnapshot {
 		return internal.ErrSnapshotCreated{

Debdiff

File lists identical (after any substitutions)

No differences were encountered in the control files

More details

Full run details