summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGravatar David Alexander <opensource@thelonelyghost.com>2016-11-11 02:46:00 -0500
committerGravatar Mike Burns <mike@mike-burns.com>2016-11-12 16:19:13 -0500
commitbc0d5b63f6c4762b7d39fb32b525f977015ff4b3 (patch)
tree004ed26a2af69caf3985e0415a84660d9f067136 /test
parentee6318598939ec0e1c147430bb2cac036a90f754 (diff)
Run hooks in a defined order
Run the hooks in alphabetical order so that people can more predictably manage their hooks. While here, clean up the NEWS.md.in.
Diffstat (limited to 'test')
-rw-r--r--test/rcdn-hooks-run-in-order.t37
-rw-r--r--test/rcup-hooks-run-in-order.t37
2 files changed, 74 insertions, 0 deletions
diff --git a/test/rcdn-hooks-run-in-order.t b/test/rcdn-hooks-run-in-order.t
new file mode 100644
index 0000000..8dff253
--- /dev/null
+++ b/test/rcdn-hooks-run-in-order.t
@@ -0,0 +1,37 @@
+ $ . "$TESTDIR/helper.sh"
+
+Pre-down and post-down hooks should run in order according to their name
+
+ $ mkdir -p .dotfiles/hooks/pre-down .dotfiles/hooks/post-down
+ > printf "#!/bin/sh\necho '1'\n" > .dotfiles/hooks/pre-down/00-test.sh
+ > printf "#!/bin/sh\necho '2'\n" > .dotfiles/hooks/pre-down/01-test.sh
+ > printf "#!/bin/sh\necho '3'\n" > .dotfiles/hooks/pre-down/02-test.sh
+ > printf "#!/bin/sh\necho '4'\n" > .dotfiles/hooks/post-down/00-test.sh
+ > printf "#!/bin/sh\necho '5'\n" > .dotfiles/hooks/post-down/01-test.sh
+ > printf "#!/bin/sh\necho '6'\n" > .dotfiles/hooks/post-down/02-test.sh
+
+ $ chmod +x .dotfiles/hooks/pre-down/00-test.sh
+ > chmod +x .dotfiles/hooks/pre-down/01-test.sh
+ > chmod +x .dotfiles/hooks/pre-down/02-test.sh
+ > chmod +x .dotfiles/hooks/post-down/00-test.sh
+ > chmod +x .dotfiles/hooks/post-down/01-test.sh
+ > chmod +x .dotfiles/hooks/post-down/02-test.sh
+
+ $ rcdn
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+
+
+Ensure that hooks run when output of lsrc is non-empty
+ $ touch .dotfiles/testrc
+ > rcdn
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
diff --git a/test/rcup-hooks-run-in-order.t b/test/rcup-hooks-run-in-order.t
new file mode 100644
index 0000000..cc5b402
--- /dev/null
+++ b/test/rcup-hooks-run-in-order.t
@@ -0,0 +1,37 @@
+ $ . "$TESTDIR/helper.sh"
+
+Pre-up hooks should run in order according to their name
+
+ $ mkdir -p .dotfiles/hooks/pre-up .dotfiles/hooks/post-up
+ > printf "#!/bin/sh\necho '1'\n" > .dotfiles/hooks/pre-up/00-test.sh
+ > printf "#!/bin/sh\necho '2'\n" > .dotfiles/hooks/pre-up/01-test.sh
+ > printf "#!/bin/sh\necho '3'\n" > .dotfiles/hooks/pre-up/02-test.sh
+ > printf "#!/bin/sh\necho '4'\n" > .dotfiles/hooks/post-up/00-test.sh
+ > printf "#!/bin/sh\necho '5'\n" > .dotfiles/hooks/post-up/01-test.sh
+ > printf "#!/bin/sh\necho '6'\n" > .dotfiles/hooks/post-up/02-test.sh
+
+ $ chmod +x .dotfiles/hooks/pre-up/00-test.sh
+ > chmod +x .dotfiles/hooks/pre-up/01-test.sh
+ > chmod +x .dotfiles/hooks/pre-up/02-test.sh
+ > chmod +x .dotfiles/hooks/post-up/00-test.sh
+ > chmod +x .dotfiles/hooks/post-up/01-test.sh
+ > chmod +x .dotfiles/hooks/post-up/02-test.sh
+
+ $ rcup
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+
+
+Ensure that hooks run when output of lsrc is non-empty
+ $ touch .dotfiles/testrc
+ > rcup
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6