Debian Codegraph @

test/rcrc-lsrc-excludes.t

raw
1 $ . "$TESTDIR/helper.sh"
2
3 Should exclude items with EXCLUDES=
4
5 $ touch .dotfiles/example
6 > touch .dotfiles/excluded
7
8 $ echo 'EXCLUDES=excluded' > $HOME/.rcrc
9
10 $ lsrc
11 /*/.example:/*/.dotfiles/example (glob)
12
13 Should accept directory:file syntax
14
15 $ mkdir .other-dotfiles
16 > touch .other-dotfiles/included
17 > touch .other-dotfiles/excluded
18
19 $ echo 'EXCLUDES="other-dotfiles:excluded"' > ~/.rcrc
20 $ echo 'DOTFILES_DIRS="~/.dotfiles ~/.other-dotfiles"' >> ~/.rcrc
21
22 $ lsrc
23 /*/.example:/*/.dotfiles/example (glob)
24 /*/.excluded:/*/.dotfiles/excluded (glob)
25 /*/.included:/*/.other-dotfiles/included (glob)
26
27 Should handle excludes with globs
28
29 $ mkdir -p fresh/hola/chao
30 > touch fresh/hola/chao/wo
31 > touch fresh/hola/chao/nemo
32 > touch fresh/hola/tossala
33 > touch fresh/hola/s
34 > touch fresh/s
35
36 $ echo 'EXCLUDES="hola/chao/* s"' > ~/.rcrc
37 $ lsrc -d fresh
38 /*/.hola/tossala:/*/fresh/hola/tossala (glob)
39
40 $ echo 'EXCLUDES="hola/chao s"' > ~/.rcrc
41 $ lsrc -d fresh
42 /*/.hola/tossala:/*/fresh/hola/tossala (glob)
43
44 When -x argument is provided, RCRC EXCLUDES are ignored
45
46 $ echo 'EXCLUDES="hola/chao"' > ~/.rcrc
47 $ lsrc -d fresh -x s
48 /*/.hola/chao/nemo:/*/fresh/hola/chao/nemo (glob)
49 /*/.hola/chao/wo:/*/fresh/hola/chao/wo (glob)
50 /*/.hola/tossala:/*/fresh/hola/tossala (glob)
51
52 $ echo 'EXCLUDES="s"' > ~/.rcrc
53 $ lsrc -d fresh -x hola/chao
54 /*/.hola/s:/*/fresh/hola/s (glob)
55 /*/.hola/tossala:/*/fresh/hola/tossala (glob)
56 /*/.s:/*/fresh/s (glob)
57
58 Should support globs in the excludes, including Emacs backup files
59
60 $ rm -rf .dotfiles
61 $ ( mkdir .dotfiles && cd .dotfiles && touch included README.md included~ README.md~ )
62
63 $ echo 'EXCLUDES="README.md *~"' > ~/.rcrc
64 $ lsrc
65 /*/.included:/*/.dotfiles/included (glob)
66
67 Should support a globs in the directory specifier
68
69 $ echo 'EXCLUDES="*:*~"' > ~/.rcrc
70 $ lsrc
71 /*/.README.md:/*/.dotfiles/README.md (glob)
72 /*/.included:/*/.dotfiles/included (glob)
73
74 And should support a mix of plain and directory tagged globs
75
76 $ echo 'EXCLUDES="README.md *:*~"' > ~/.rcrc
77 $ lsrc
78 /*/.included:/*/.dotfiles/included (glob)
79
80 And a redundant list of implied and specified globs
81
82 $ echo 'EXCLUDES="README.md *~ *:*~"' > ~/.rcrc
83 $ lsrc
84 /*/.included:/*/.dotfiles/included (glob)
85