summaryrefslogtreecommitdiff
path: root/tests.branching
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-03-22 17:36:12 +0000
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-03-22 17:36:12 +0000
commit16037737eb6bbea91b4cc21e3895efda1f35f3ff (patch)
tree4137c7c078ea14b43ed3ccc525fdcef0184a5aa0 /tests.branching
parent3f4031d1c0237636359e14304484fb569fcecc43 (diff)
downloadmorph-16037737eb6bbea91b4cc21e3895efda1f35f3ff.tar.gz
Implement "morph init" and fix tests accordingly
Diffstat (limited to 'tests.branching')
-rwxr-xr-xtests.branching/init-cwd.script4
-rw-r--r--tests.branching/init-cwd.stdout3
-rwxr-xr-xtests.branching/init-default.script4
-rw-r--r--tests.branching/init-default.stdout3
-rwxr-xr-xtests.branching/init-existing.script4
-rw-r--r--tests.branching/init-existing.stdout3
-rwxr-xr-xtests.branching/init-newdir.script1
-rw-r--r--tests.branching/init-newdir.stderr1
-rwxr-xr-xtests.branching/init-nonempty.script4
-rw-r--r--tests.branching/init-nonempty.stderr1
-rwxr-xr-xtests.branching/setup22
11 files changed, 42 insertions, 8 deletions
diff --git a/tests.branching/init-cwd.script b/tests.branching/init-cwd.script
index 53bb4599..91c23506 100755
--- a/tests.branching/init-cwd.script
+++ b/tests.branching/init-cwd.script
@@ -19,7 +19,7 @@ set -eu
# Test that "morph init" works for the current working directory.
-cd "$DATADIR"
+cd "$DATADIR/mine"
"$SRCDIR/scripts/test-morph" init .
-"$SRCDIR/scripts/list-tree" "$DATADIR"
+"$SRCDIR/scripts/list-tree" "$DATADIR/mine"
diff --git a/tests.branching/init-cwd.stdout b/tests.branching/init-cwd.stdout
new file mode 100644
index 00000000..d1f25a19
--- /dev/null
+++ b/tests.branching/init-cwd.stdout
@@ -0,0 +1,3 @@
+d .
+d ./.morph
+d ./.morph/cache
diff --git a/tests.branching/init-default.script b/tests.branching/init-default.script
index 4e7a3420..5ec5148d 100755
--- a/tests.branching/init-default.script
+++ b/tests.branching/init-default.script
@@ -19,6 +19,6 @@ set -eu
# Test that "morph init" works without an explicit argument.
-cd "$DATADIR"
+cd "$DATADIR/mine"
"$SRCDIR/scripts/test-morph" init
-"$SRCDIR/scripts/list-tree" "$DATADIR"
+"$SRCDIR/scripts/list-tree" "$DATADIR/mine"
diff --git a/tests.branching/init-default.stdout b/tests.branching/init-default.stdout
new file mode 100644
index 00000000..d1f25a19
--- /dev/null
+++ b/tests.branching/init-default.stdout
@@ -0,0 +1,3 @@
+d .
+d ./.morph
+d ./.morph/cache
diff --git a/tests.branching/init-existing.script b/tests.branching/init-existing.script
index 1f778ffd..59b658aa 100755
--- a/tests.branching/init-existing.script
+++ b/tests.branching/init-existing.script
@@ -20,5 +20,5 @@ set -eu
# Test that "morph init" works when given the name of an existing,
# empty directory.
-"$SRCDIR/scripts/test-morph" init "$DATADIR"
-"$SRCDIR/scripts/list-tree" "$DATADIR"
+"$SRCDIR/scripts/test-morph" init "$DATADIR/mine"
+"$SRCDIR/scripts/list-tree" "$DATADIR/mine"
diff --git a/tests.branching/init-existing.stdout b/tests.branching/init-existing.stdout
new file mode 100644
index 00000000..d1f25a19
--- /dev/null
+++ b/tests.branching/init-existing.stdout
@@ -0,0 +1,3 @@
+d .
+d ./.morph
+d ./.morph/cache
diff --git a/tests.branching/init-newdir.script b/tests.branching/init-newdir.script
index 6c1bdcd0..3bb4a1ba 100755
--- a/tests.branching/init-newdir.script
+++ b/tests.branching/init-newdir.script
@@ -21,3 +21,4 @@ set -eu
# directory that does not exist yet.
"$SRCDIR/scripts/test-morph" init "$DATADIR/foo"
+
diff --git a/tests.branching/init-newdir.stderr b/tests.branching/init-newdir.stderr
new file mode 100644
index 00000000..066d69c0
--- /dev/null
+++ b/tests.branching/init-newdir.stderr
@@ -0,0 +1 @@
+ERROR: can only initialize an existing empty directory: TMP/foo
diff --git a/tests.branching/init-nonempty.script b/tests.branching/init-nonempty.script
index 8e18bb2f..28762d08 100755
--- a/tests.branching/init-nonempty.script
+++ b/tests.branching/init-nonempty.script
@@ -20,5 +20,5 @@ set -eu
# Test that "morph init" fails when given the name of an existing,
# non-empty directory.
-touch "$DATADIR/foo"
-"$SRCDIR/scripts/test-morph" init "$DATADIR"
+touch "$DATADIR/mine/foo"
+"$SRCDIR/scripts/test-morph" init "$DATADIR/mine"
diff --git a/tests.branching/init-nonempty.stderr b/tests.branching/init-nonempty.stderr
new file mode 100644
index 00000000..4ed4bba8
--- /dev/null
+++ b/tests.branching/init-nonempty.stderr
@@ -0,0 +1 @@
+ERROR: can only initialize empty directory: TMP/mine
diff --git a/tests.branching/setup b/tests.branching/setup
new file mode 100755
index 00000000..cb1c2f4a
--- /dev/null
+++ b/tests.branching/setup
@@ -0,0 +1,22 @@
+#!/bin/sh
+# Copyright (C) 2012 Codethink Limited
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+
+# Set up $DATADIR.
+
+set -eu
+
+mkdir "$DATADIR/mine"