summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/lsrc-globs.t7
-rw-r--r--test/lsrc-sigils.t9
-rw-r--r--test/lsrc-undotted-star.t14
-rw-r--r--test/mkrc-no-symlinks.t26
4 files changed, 56 insertions, 0 deletions
diff --git a/test/lsrc-globs.t b/test/lsrc-globs.t
new file mode 100644
index 0000000..cf04385
--- /dev/null
+++ b/test/lsrc-globs.t
@@ -0,0 +1,7 @@
+ $ . "$TESTDIR/helper.sh"
+
+Keeps globs as globs
+
+ $ mkdir vimulator
+ > lsrc -vvv -x '*vim*' 2>&1 | grep exclude_file_globs
+ exclude_file_globs: *vim*
diff --git a/test/lsrc-sigils.t b/test/lsrc-sigils.t
index 98573b2..9bdc82d 100644
--- a/test/lsrc-sigils.t
+++ b/test/lsrc-sigils.t
@@ -14,3 +14,12 @@ Should print X for files in COPY_ALWAYS
$ COPY_ALWAYS=copy lsrc -F
/*/.copy:/*/.dotfiles/copy:X (glob)
/*/.example:/*/.dotfiles/example:@ (glob)
+
+Should print $ for directory links
+
+ $ mkdir .dotfiles/folder
+
+ $ SYMLINK_DIRS=folder COPY_ALWAYS=copy lsrc -F
+ /*/.copy:/*/.dotfiles/copy:X (glob)
+ /*/.example:/*/.dotfiles/example:@ (glob)
+ /*/.folder:/*/.dotfiles/folder:$ (glob)
diff --git a/test/lsrc-undotted-star.t b/test/lsrc-undotted-star.t
new file mode 100644
index 0000000..04db053
--- /dev/null
+++ b/test/lsrc-undotted-star.t
@@ -0,0 +1,14 @@
+ $ . "$TESTDIR/helper.sh"
+
+Should undot files with -U, with wildcard * expansion
+
+ $ touch .dotfiles/example
+ > touch .dotfiles/undotted
+
+ $ lsrc -v -U '*'
+ /*/example:/*/.dotfiles/example (glob)
+ /*/undotted:/*/.dotfiles/undotted (glob)
+
+ $ lsrc -v -U '*:*'
+ /*/example:/*/.dotfiles/example (glob)
+ /*/undotted:/*/.dotfiles/undotted (glob)
diff --git a/test/mkrc-no-symlinks.t b/test/mkrc-no-symlinks.t
new file mode 100644
index 0000000..e37d56a
--- /dev/null
+++ b/test/mkrc-no-symlinks.t
@@ -0,0 +1,26 @@
+ $ . "$TESTDIR/helper.sh"
+
+Passing a linked file is rejected.
+We need a second path not under what will be $HOME
+
+ $ EXTDIR="${CRAMTMP}2"
+ > mkdir -p "$EXTDIR"
+ > echo 'Content' > "$EXTDIR/example"
+ > ln -s "$EXTDIR/example" "$HOME/.example"
+
+ $ mkrc .example
+ '.example' is a symlink. Cannot process file.
+ [1]
+
+ $ refute "is a symlink" -h $HOME/.dotfiles/.example
+
+Passing a file in one linked dir is rejected
+
+ $ mkdir "$HOME/.config"
+ > ln -s "$EXTDIR/" "$HOME/.config/tmpdir"
+
+ $ mkrc -v .config/tmpdir/example
+ '.config/tmpdir/example' path contains a symlink (tmpdir). Cannot process file.
+ [1]
+
+ $ refute "is a symlink" -h "$HOME/.dotfiles/config/tmpdir/example"