summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGravatar Christian Höltje <docwhat@gerf.org>2015-03-18 22:45:22 -0400
committerGravatar Mike Burns <mike@mike-burns.com>2015-06-05 11:23:38 +0200
commit9a3f6cc532080a5b7095037835f778c9a621f642 (patch)
tree5c5ce89c02c0bc65776ab6a0628eda246891b36f /test
parentaec2af1e243054ba864279889468379ad0784e63 (diff)
Changes the priority to: hosts->tags->default
This changes the order that things are pulled in so that: 1. Hosts take priority over everything. 2. Tags take priority over default. 3. Default takes priority over nothing. Closes #94
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am1
-rw-r--r--test/lsrc-host-tags-default.t17
-rw-r--r--test/lsrc-hostname.t4
-rw-r--r--test/lsrc-tags.t2
-rw-r--r--test/rcrc-hostname.t4
5 files changed, 23 insertions, 5 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index 065b2d1..4c5e059 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -8,6 +8,7 @@ TESTS = \
lsrc-tags.t \
lsrc-usage.t \
lsrc-undotted.t \
+ lsrc-host-tags-default.t \
mkrc-alternate-dotfiles-dir.t \
mkrc-copy-file.t \
mkrc-host-file.t \
diff --git a/test/lsrc-host-tags-default.t b/test/lsrc-host-tags-default.t
new file mode 100644
index 0000000..aa9a253
--- /dev/null
+++ b/test/lsrc-host-tags-default.t
@@ -0,0 +1,17 @@
+ $ . "$TESTDIR/helper.sh"
+
+Hosts override tags override defaults
+
+ $ touch .dotfiles/host-example
+ > touch .dotfiles/tag-example
+ > touch .dotfiles/default-example
+ > mkdir .dotfiles/tag-firetruck
+ > touch .dotfiles/tag-firetruck/host-example
+ > touch .dotfiles/tag-firetruck/tag-example
+ > mkdir .dotfiles/host-eggplant
+ > touch .dotfiles/host-eggplant/host-example
+
+ $ lsrc -B eggplant -t firetruck
+ /*/.host-example:/*/.dotfiles/host-eggplant/host-example (glob)
+ /*/.tag-example:/*/.dotfiles/tag-firetruck/tag-example (glob)
+ /*/.default-example:/*/.dotfiles/default-example (glob)
diff --git a/test/lsrc-hostname.t b/test/lsrc-hostname.t
index 35ad0fe..a69808d 100644
--- a/test/lsrc-hostname.t
+++ b/test/lsrc-hostname.t
@@ -9,9 +9,9 @@ Should include entries that match hostname
> touch .dotfiles/host-not-hostname/nh-example
$ lsrc
- /*/.example:/*/.dotfiles/example (glob)
/*/.h-example:/*/.dotfiles/host-*/h-example (glob)
+ /*/.example:/*/.dotfiles/example (glob)
$ lsrc -B not-hostname
- /*/.example:/*/.dotfiles/example (glob)
/*/.nh-example:/*/.dotfiles/host-*/nh-example (glob)
+ /*/.example:/*/.dotfiles/example (glob)
diff --git a/test/lsrc-tags.t b/test/lsrc-tags.t
index 97f77db..4913daf 100644
--- a/test/lsrc-tags.t
+++ b/test/lsrc-tags.t
@@ -9,6 +9,6 @@ Should include entries that match passed tags
> touch .dotfiles/tag-bar/b-example
$ lsrc -t foo -t bar
- /*/.example:/*/.dotfiles/example (glob)
/*/.f-example:/*/.dotfiles/tag-foo/f-example (glob)
/*/.b-example:/*/.dotfiles/tag-bar/b-example (glob)
+ /*/.example:/*/.dotfiles/example (glob)
diff --git a/test/rcrc-hostname.t b/test/rcrc-hostname.t
index 1008cd9..f2ad722 100644
--- a/test/rcrc-hostname.t
+++ b/test/rcrc-hostname.t
@@ -13,9 +13,9 @@ The hostname can be set in ~/.rcrc
$ echo 'HOSTNAME="eggplant_firetruck"' > $HOME/.rcrc
$ lsrc
- /*/.example:/*/.dotfiles/example (glob)
/*/.nh-example:/*/.dotfiles/host-eggplant_firetruck/nh-example (glob)
+ /*/.example:/*/.dotfiles/example (glob)
$ lsrc -B haircut_hammer
- /*/.example:/*/.dotfiles/example (glob)
/*/.nh-example:/*/.dotfiles/host-haircut_hammer/nh-example (glob)
+ /*/.example:/*/.dotfiles/example (glob)