-
Notifications
You must be signed in to change notification settings - Fork 1
/
gtags-test.sh
executable file
·158 lines (141 loc) · 3.98 KB
/
gtags-test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#!/usr/bin/env bash
set -euo pipefail
global_should_find() {
local expect_num_matches symbol
expect_num_matches=$1
symbol=$2
if ! global -x --literal "$symbol" | wc -l | grep -q "\<$expect_num_matches\>" ; then
echo "global_should_find(): failed (expect $expect_num_matches match): $symbol" >&2
global -x --literal "$symbol" >&2
return 1
fi
}
SYMBOLS_GLOBAL_SHOULD_FIND_ONE=(
dot_sh_fun
less-var-str
less-var-font-size
less-id-line1
less-id-line2
less-id-with-elem
less-class-line1
less-class-line2
less-class-with-elem1
less-class-with-elem2
scss-var-str
scss-var-font-size
scss-mixin-no-params
scss-mixin-one-param
scss-mixin-many-params
scss-id-line1
scss-id-line2
scss-id-with-elem
scss-class-line1
scss-class-line2
scss-class-with-elem1
scss-class-with-elem2
jsFunctionNoParams
jsFunctionOneParam
jsFunctionManyParams
jsFunctionMultilineParams
jsFunctionSpaceBeforeParams
JsFunctionCapitalized
jsFunctionAsync
jsFunctionAsyncGenerator
jsFunctionGeneratorSpaceBeforeAsterisk
jsFunctionGeneratorSpaceAfterAsterisk
jsFunctionIIFE
jsFunctionAssignFunctionNoParams
jsFunctionAssignFunctionOneParam
jsFunctionAssignFunctionManyParams
jsFunctionAssignFunctionMultilineParams
jsFunctionAssignFunctionSpaceBeforeParams
jsFunctionAssignAsync
jsFunctionAssignAsyncGenerator
jsFunctionAssignGeneratorSpaceBeforeAsterisk
jsFunctionAssignGeneratorSpaceAfterAsterisk
jsFunctionAssignArrow
jsNullSimple
jsBooleanTrue
jsBooleanFalse
jsNumberSimple
jsStringSingleQuoted
jsStringDoubleQuoted
jsStringTemplateLiteral
jsStringTaggedTemplateLiteral
jsRegexSimple
jsArraySimple
JsArrayCapitalized
jsObjectSimple
JsObjectCapitalized
jsFieldSimple
JsFieldCapitalized
jsFieldCommaBefore
jsFieldAssignDotNotation
jsFieldSingleQuoted
jsFieldDoubleQuoted
jsFieldJSXAttribute
JsClassStatementNoExtends
JsClassStatementExtends
JsClassStatementNewlineBeforeOpeningBrace
JsClassExpressionAnonymousSpaceAfterClass
JsClassExpressionAnonymousNoSpaceAfterClass
JsClassExpressionNameInClassScope
JsClassExpressionReactCreate
jsMethodNoParams
jsMethodOneParam
jsMethodManyParams
JsMethodCapitalized
jsMethodAtStartOfLine
jsMethodStatic
jsMethodStaticAtStartOfLine
jsMethodAsync
jsMethodAsyncAtStartOfLine
jsMethodAsyncGenerator
jsMethodStaticAsync
jsMethodStaticAsyncAtStartOfLine
jsMethodGeneratorNoSpaceAfterAsterisk
jsMethodGeneratorSpaceAfterAsterisk
jsMethodGeneratorAtStartOfLine
jsMethodStaticGeneratorSpaceBeforeAsterisk
jsMethodStaticGeneratorSpaceAfterAsterisk
jsMethodStaticAsyncGenerator
RUBY_CONSTANT_SIMPLE
yaml_mapping_plain
yaml_mapping_single_quoted
yaml_mapping_double_quoted
yaml_ansible_register_key_plain_value_plain
yaml_ansible_register_key_plain_value_single_quoted
yaml_ansible_register_key_plain_value_double_quoted
yaml_ansible_register_key_single_quoted_value_plain
yaml_ansible_register_key_double_quoted_value_plain
yaml_anchor-dedicated_line
yaml_anchor-map
yaml_anchor-list_elem
yaml_anchor-before_block_scalar
)
# shellcheck disable=SC2016
SYMBOLS_GLOBAL_SHOULD_FIND_ZERO=(
less-elem
'less-id-@{less-str}'
'less-class-@{less-str}'
scss-elem
'scss-id-#{$scss-str}'
'scss-class-#{$scss-str}'
jsFunctionCall
)
test_global_find_symbols() (
cd "${0%/*}/fixture/gtags/" || exit 2
gtags .
for symbol in "${SYMBOLS_GLOBAL_SHOULD_FIND_ONE[@]}"; do
global_should_find 1 "$symbol"
done
for symbol in "${SYMBOLS_GLOBAL_SHOULD_FIND_ZERO[@]}"; do
global_should_find 0 "$symbol"
done
)
if command -v global &>/dev/null; then
TEST_SOURCE=$0 source test/support/suite.sh
else
# shellcheck disable=SC2016
printf '[skip] `global` not found\n' >&2
fi