diff options
author | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2012-03-22 17:07:49 +0000 |
---|---|---|
committer | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2012-03-22 17:07:49 +0000 |
commit | 5163d09c24285690c28456fa45837affe6ae591a (patch) | |
tree | 403375552c777c2f8d650733ad7eb2a5d4348a55 /tests.branching | |
parent | eff96464d8ece0a91846e765e828b6349481dcb3 (diff) | |
download | morph-5163d09c24285690c28456fa45837affe6ae591a.tar.gz |
Add test cases for "morph init"
Diffstat (limited to 'tests.branching')
-rwxr-xr-x | tests.branching/init-cwd.script | 25 | ||||
-rwxr-xr-x | tests.branching/init-default.script | 24 | ||||
-rwxr-xr-x | tests.branching/init-existing.script | 24 | ||||
-rw-r--r-- | tests.branching/init-newdir.exit | 1 | ||||
-rwxr-xr-x | tests.branching/init-newdir.script | 23 | ||||
-rw-r--r-- | tests.branching/init-nonempty.exit | 1 | ||||
-rwxr-xr-x | tests.branching/init-nonempty.script | 24 | ||||
-rwxr-xr-x | tests.branching/teardown | 22 |
8 files changed, 144 insertions, 0 deletions
diff --git a/tests.branching/init-cwd.script b/tests.branching/init-cwd.script new file mode 100755 index 00000000..53bb4599 --- /dev/null +++ b/tests.branching/init-cwd.script @@ -0,0 +1,25 @@ +#!/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 -eu + +# Test that "morph init" works for the current working directory. + +cd "$DATADIR" +"$SRCDIR/scripts/test-morph" init . +"$SRCDIR/scripts/list-tree" "$DATADIR" + diff --git a/tests.branching/init-default.script b/tests.branching/init-default.script new file mode 100755 index 00000000..4e7a3420 --- /dev/null +++ b/tests.branching/init-default.script @@ -0,0 +1,24 @@ +#!/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 -eu + +# Test that "morph init" works without an explicit argument. + +cd "$DATADIR" +"$SRCDIR/scripts/test-morph" init +"$SRCDIR/scripts/list-tree" "$DATADIR" diff --git a/tests.branching/init-existing.script b/tests.branching/init-existing.script new file mode 100755 index 00000000..1f778ffd --- /dev/null +++ b/tests.branching/init-existing.script @@ -0,0 +1,24 @@ +#!/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 -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" diff --git a/tests.branching/init-newdir.exit b/tests.branching/init-newdir.exit new file mode 100644 index 00000000..d00491fd --- /dev/null +++ b/tests.branching/init-newdir.exit @@ -0,0 +1 @@ +1 diff --git a/tests.branching/init-newdir.script b/tests.branching/init-newdir.script new file mode 100755 index 00000000..6c1bdcd0 --- /dev/null +++ b/tests.branching/init-newdir.script @@ -0,0 +1,23 @@ +#!/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 -eu + +# Test that "morph init" gives an error when given the name of a +# directory that does not exist yet. + +"$SRCDIR/scripts/test-morph" init "$DATADIR/foo" diff --git a/tests.branching/init-nonempty.exit b/tests.branching/init-nonempty.exit new file mode 100644 index 00000000..d00491fd --- /dev/null +++ b/tests.branching/init-nonempty.exit @@ -0,0 +1 @@ +1 diff --git a/tests.branching/init-nonempty.script b/tests.branching/init-nonempty.script new file mode 100755 index 00000000..8e18bb2f --- /dev/null +++ b/tests.branching/init-nonempty.script @@ -0,0 +1,24 @@ +#!/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 -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" diff --git a/tests.branching/teardown b/tests.branching/teardown new file mode 100755 index 00000000..94928416 --- /dev/null +++ b/tests.branching/teardown @@ -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. + + +# Clean up $DATADIR. + +set -eu + +find "$DATADIR" -mindepth 1 -delete |