[PATCH] tests: unify test-permissions

Adrian Buehlmann adrian at cadifra.com
Sun Sep 12 12:28:44 CDT 2010


# HG changeset patch
# User Adrian Buehlmann <adrian at cadifra.com>
# Date 1284309782 -7200
# Node ID c26c8f8c118bc0c9f5febda48d028de15be81381
# Parent  dde0bb4570fddcbd56b25cc5699601f8da0441ca
tests: unify test-permissions

diff --git a/tests/test-permissions.out b/tests/test-permissions.out
deleted file mode 100644
--- a/tests/test-permissions.out
+++ /dev/null
@@ -1,36 +0,0 @@
-% hg init t
-% hg add a
-% hg commit
-% hg verify
-checking changesets
-checking manifests
-crosschecking files in changesets and manifests
-checking files
-1 files, 1 changesets, 1 total revisions
-% hg verify
-checking changesets
-checking manifests
-crosschecking files in changesets and manifests
-checking files
-verify failed
-% hg verify
-checking changesets
-checking manifests
-crosschecking files in changesets and manifests
-checking files
-1 files, 1 changesets, 1 total revisions
-% hg commit
-commit failed
-% hg diff
-diff -r 2a18120dc1c9 a
---- a/a
-+++ b/a
-@@ -1,1 +1,1 @@
--foo
-+barber
-% hg status
-M a
-? dir/a
-% hg status
-dir: Permission denied
-M a
diff --git a/tests/test-permissions b/tests/test-permissions.t
old mode 100755
new mode 100644
rename from tests/test-permissions
rename to tests/test-permissions.t
--- a/tests/test-permissions
+++ b/tests/test-permissions.t
@@ -1,37 +1,69 @@
-#!/bin/sh
+  $ hg init t
+  $ cd t
 
-echo '% hg init t'
-hg init t
-cd t
-echo foo > a
-echo '% hg add a'
-hg add a
-echo '% hg commit'
-hg commit -m "1"
-echo '% hg verify'
-hg verify
-chmod -r .hg/store/data/a.i
-echo '% hg verify'
-hg verify 2>/dev/null || echo verify failed
-chmod +r .hg/store/data/a.i
-echo '% hg verify'
-hg verify 2>/dev/null || echo verify failed
-chmod -w .hg/store/data/a.i
-echo barber > a
-echo '% hg commit'
-hg commit -m "2" 2>/dev/null || echo commit failed
-chmod -w .
-echo '% hg diff'
-hg diff --nodates
-chmod +w .
+  $ echo foo > a
+  $ hg add a
 
-chmod +w .hg/store/data/a.i
-mkdir dir
-touch dir/a
-echo '% hg status'
-hg status
-chmod -rx dir
-echo '% hg status'
-hg status
-# reenable perm to allow deletion
-chmod +rx dir
+  $ hg commit -m "1"
+
+  $ hg verify
+  checking changesets
+  checking manifests
+  crosschecking files in changesets and manifests
+  checking files
+  1 files, 1 changesets, 1 total revisions
+
+  $ chmod -r .hg/store/data/a.i
+
+  $ hg verify || echo %%% verify failed
+  checking changesets
+  checking manifests
+  crosschecking files in changesets and manifests
+  checking files
+  abort: Permission denied: .*
+  %%% verify failed
+
+  $ chmod +r .hg/store/data/a.i
+
+  $ hg verify || echo %%% verify failed
+  checking changesets
+  checking manifests
+  crosschecking files in changesets and manifests
+  checking files
+  1 files, 1 changesets, 1 total revisions
+
+  $ chmod -w .hg/store/data/a.i
+
+  $ echo barber > a
+  $ hg commit -m "2" || echo %%% commit failed
+  trouble committing a!
+  abort: Permission denied: .*
+  %%% commit failed
+
+  $ chmod -w .
+
+  $ hg diff --nodates
+  diff -r 2a18120dc1c9 a
+  --- a/a
+  +++ b/a
+  @@ -1,1 +1,1 @@
+  -foo
+  +barber
+
+  $ chmod +w .
+
+  $ chmod +w .hg/store/data/a.i
+  $ mkdir dir
+  $ touch dir/a
+  $ hg status
+  M a
+  ? dir/a
+  $ chmod -rx dir
+  $ hg status
+  dir: Permission denied
+  M a
+
+Reenable perm to allow deletion:
+
+  $ chmod +rx dir
+


More information about the Mercurial-devel mailing list