From 9a3f6cc532080a5b7095037835f778c9a621f642 Mon Sep 17 00:00:00 2001 From: Christian Höltje Date: Wed, 18 Mar 2015 22:45:22 -0400 Subject: 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 --- test/Makefile.am | 1 + test/lsrc-host-tags-default.t | 17 +++++++++++++++++ test/lsrc-hostname.t | 4 ++-- test/lsrc-tags.t | 2 +- test/rcrc-hostname.t | 4 ++-- 5 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 test/lsrc-host-tags-default.t (limited to 'test') 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) -- cgit v1.2.3