git » summer » commit 7dbf44b

Add tests for passing a single file as root

author Alberto Bertogli
2023-04-05 23:06:28 UTC
committer Alberto Bertogli
2023-04-05 23:06:28 UTC
parent 7a34a0c42da75b2084ac35de43e32babf5f14c54

Add tests for passing a single file as root

test/singlefile.t +24 -0

diff --git a/test/singlefile.t b/test/singlefile.t
new file mode 100644
index 0000000..62d15fd
--- /dev/null
+++ b/test/singlefile.t
@@ -0,0 +1,24 @@
+Test that summer works fine when given a file instead of a directory.
+
+  $ alias summer="$TESTDIR/../summer"
+  $ touch empty
+  $ echo marola > hola
+
+  $ summer -v generate ./empty
+  "./empty": writing checksum \(checksum:0, mtime:\d+\) (re)
+  0s: 0 matched, 0 modified, 1 new, 0 corrupted
+
+  $ summer -v verify .
+  "empty": match \(checksum:0, mtime:\d+\) (re)
+  "hola": missing checksum attribute
+  0s: 1 matched, 0 modified, 1 new, 0 corrupted
+
+  $ summer update ./hola
+  \r (no-eol) (esc)
+  0s: 0 matched, 0 modified, 1 new, 0 corrupted
+
+  $ summer -v verify .
+  "empty": match \(checksum:0, mtime:\d+\) (re)
+  "hola": match \(checksum:\w+, mtime:\d+\) (re)
+  0s: 2 matched, 0 modified, 0 new, 0 corrupted
+