fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

NahorFix failing system tests on Cygwin440e7fcbc

master
2.1 KiB94 linesraw
1# RUN: %fish %s
2
3set -l oldpwd $PWD
4cd (mktemp -d)
5set tmpdir (pwd -P)
6
7# Hidden files are only matched with explicit dot.
8touch .hidden visible
9string join \n * | sort
10# CHECK: visible
11string join \n .* | sort
12# CHECK: .hidden
13rm -Rf .hidden visible
14
15# Trailing slash matches only directories.
16touch abc1
17mkdir abc2
18string join \n * | sort
19# CHECK: abc1
20# CHECK: abc2
21string join \n */ | sort
22# CHECK: abc2/
23rm -Rf *
24
25# Symlinks are descended into independently.
26# Here dir2/link2 is symlinked to dir1/child1.
27# The contents of dir2 will be explored twice.
28mkdir -p dir1/child1
29touch dir1/child1/anyfile
30mkdir dir2
31ln -s ../dir1/child1 dir2/link2
32string join \n **/anyfile | sort
33# CHECK: dir1/child1/anyfile
34# CHECK: dir2/link2/anyfile
35
36# But symlink loops only get explored once.
37mkdir -p dir1/child2/grandchild1
38touch dir1/child2/grandchild1/differentfile
39if cygwin_nosymlinks
40    echo dir1/child2/grandchild1/differentfile
41else
42    ln -s ../../child2/grandchild1 dir1/child2/grandchild1/link2
43    echo **/differentfile
44end
45# CHECK: dir1/child2/grandchild1/differentfile
46rm -Rf *
47
48# Recursive globs handling.
49mkdir -p dir_a1/dir_a2/dir_a3
50touch dir_a1/dir_a2/dir_a3/file_a
51mkdir -p dir_b1/dir_b2/dir_b3
52touch dir_b1/dir_b2/dir_b3/file_b
53string join \n **/file_* | sort
54# CHECK: dir_a1/dir_a2/dir_a3/file_a
55# CHECK: dir_b1/dir_b2/dir_b3/file_b
56
57string join \n **a3/file_* | sort
58# CHECK: dir_a1/dir_a2/dir_a3/file_a
59
60string join \n ** | sort
61# CHECK: dir_a1
62# CHECK: dir_a1/dir_a2
63# CHECK: dir_a1/dir_a2/dir_a3
64# CHECK: dir_a1/dir_a2/dir_a3/file_a
65# CHECK: dir_b1
66# CHECK: dir_b1/dir_b2
67# CHECK: dir_b1/dir_b2/dir_b3
68# CHECK: dir_b1/dir_b2/dir_b3/file_b
69
70string join \n **/ | sort
71# CHECK: dir_a1/
72# CHECK: dir_a1/dir_a2/
73# CHECK: dir_a1/dir_a2/dir_a3/
74# CHECK: dir_b1/
75# CHECK: dir_b1/dir_b2/
76# CHECK: dir_b1/dir_b2/dir_b3/
77
78string join \n **a2/** | sort
79# CHECK: dir_a1/dir_a2/dir_a3
80# CHECK: dir_a1/dir_a2/dir_a3/file_a
81
82rm -Rf *
83
84# Special behavior for #7222.
85# The literal segment ** matches in the same directory.
86mkdir foo
87touch bar foo/bar
88string join \n **/bar | sort
89# CHECK: bar
90# CHECK: foo/bar
91
92# Clean up.
93cd $oldpwd
94rm -Rf $tmpdir