Skip to content

Commit 1b58d41

Browse files
davidanthoffgithub-actions[bot]
authored andcommitted
Format files using DocumentFormat
1 parent 1b71ecc commit 1b58d41

File tree

1 file changed

+37
-37
lines changed

1 file changed

+37
-37
lines changed

src/packagedef.jl

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ function find_test_detail!(node, testitems, testsetups, testerrors)
1010
child_nodes = children(node)
1111

1212
# Check for various syntax errors
13-
if length(child_nodes)==1
14-
push!(testerrors, (name = "Test definition error", message="Your @testitem is missing a name and code block.", range=testitem_range))
13+
if length(child_nodes) == 1
14+
push!(testerrors, (name="Test definition error", message="Your @testitem is missing a name and code block.", range=testitem_range))
1515
return
16-
elseif length(child_nodes)>1 && !(kind(child_nodes[2]) == K"string")
17-
push!(testerrors, (name = "Test definition error", message="Your @testitem must have a first argument that is of type String for the name.", range=testitem_range))
16+
elseif length(child_nodes) > 1 && !(kind(child_nodes[2]) == K"string")
17+
push!(testerrors, (name="Test definition error", message="Your @testitem must have a first argument that is of type String for the name.", range=testitem_range))
1818
return
19-
elseif length(child_nodes)==2
20-
push!(testerrors, (name = node[2,1].val, message="Your @testitem is missing a code block argument.", range=testitem_range))
19+
elseif length(child_nodes) == 2
20+
push!(testerrors, (name=node[2, 1].val, message="Your @testitem is missing a code block argument.", range=testitem_range))
2121
return
2222
elseif !(kind(child_nodes[end]) == K"block")
23-
push!(testerrors, (name = node[2,1].val, message="The final argument of a @testitem must be a begin end block.", range=testitem_range))
23+
push!(testerrors, (name=node[2, 1].val, message="The final argument of a @testitem must be a begin end block.", range=testitem_range))
2424
return
2525
else
2626
option_tags = nothing
@@ -30,79 +30,79 @@ function find_test_detail!(node, testitems, testsetups, testerrors)
3030
# Now check our keyword args
3131
for i in child_nodes[3:end-1]
3232
if kind(i) != K"="
33-
push!(testerrors, (name = node[2,1].val, message="The arguments to a @testitem must be in keyword format.", range=testitem_range))
33+
push!(testerrors, (name=node[2, 1].val, message="The arguments to a @testitem must be in keyword format.", range=testitem_range))
3434
return
35-
elseif !(length(children(i))==2)
35+
elseif !(length(children(i)) == 2)
3636
error("This code path should not be possible.")
3737
elseif kind(i[1]) == K"Identifier" && i[1].val == :tags
38-
if option_tags!==nothing
39-
push!(testerrors, (name = node[2,1].val, message="The keyword argument tags cannot be specified more than once.", range=testitem_range))
38+
if option_tags !== nothing
39+
push!(testerrors, (name=node[2, 1].val, message="The keyword argument tags cannot be specified more than once.", range=testitem_range))
4040
return
4141
end
4242

4343
if kind(i[2]) != K"vect"
44-
push!(testerrors, (name = node[2,1].val, message="The keyword argument tags only accepts a vector of symbols.", range=testitem_range))
44+
push!(testerrors, (name=node[2, 1].val, message="The keyword argument tags only accepts a vector of symbols.", range=testitem_range))
4545
return
4646
end
4747

4848
option_tags = Symbol[]
4949

5050
for j in children(i[2])
5151
if kind(j) != K"quote" || length(children(j)) != 1 || kind(j[1]) != K"Identifier"
52-
push!(testerrors, (name = node[2,1].val, message="The keyword argument tags only accepts a vector of symbols.", range=testitem_range))
52+
push!(testerrors, (name=node[2, 1].val, message="The keyword argument tags only accepts a vector of symbols.", range=testitem_range))
5353
return
5454
end
5555

5656
push!(option_tags, j[1].val)
5757
end
5858
elseif kind(i[1]) == K"Identifier" && i[1].val == :default_imports
5959
if option_default_imports !== nothing
60-
push!(testerrors, (name = node[2,1].val, message="The keyword argument default_imports cannot be specified more than once.", range=testitem_range))
60+
push!(testerrors, (name=node[2, 1].val, message="The keyword argument default_imports cannot be specified more than once.", range=testitem_range))
6161
return
6262
end
6363

6464
if !(i[2].val in (true, false))
65-
push!(testerrors, (name = node[2,1].val, message="The keyword argument default_imports only accepts bool values.", range=testitem_range))
65+
push!(testerrors, (name=node[2, 1].val, message="The keyword argument default_imports only accepts bool values.", range=testitem_range))
6666
return
6767
end
6868

6969
option_default_imports = i[2].val
7070
elseif kind(i[1]) == K"Identifier" && i[1].val == :setup
71-
if option_setup!==nothing
72-
push!(testerrors, (name = node[2,1].val, message="The keyword argument setup cannot be specified more than once.", range=testitem_range))
71+
if option_setup !== nothing
72+
push!(testerrors, (name=node[2, 1].val, message="The keyword argument setup cannot be specified more than once.", range=testitem_range))
7373
return
7474
end
7575

7676
if kind(i[2]) != K"vect"
77-
push!(testerrors, (name = node[2,1].val, message="The keyword argument `setup` only accepts a vector of `@testsetup module` names.", range=testitem_range))
77+
push!(testerrors, (name=node[2, 1].val, message="The keyword argument `setup` only accepts a vector of `@testsetup module` names.", range=testitem_range))
7878
return
7979
end
8080

8181
option_setup = Symbol[]
8282

8383
for j in children(i[2])
8484
if kind(j) != K"Identifier"
85-
push!(testerrors, (name = node[2,1].val, message="The keyword argument `setup` only accepts a vector of `@testsetup module` names.", range=testitem_range))
85+
push!(testerrors, (name=node[2, 1].val, message="The keyword argument `setup` only accepts a vector of `@testsetup module` names.", range=testitem_range))
8686
return
8787
end
8888

8989
push!(option_setup, j.val)
9090
end
9191
else
92-
push!(testerrors, (name = node[2,1].val, message="Unknown keyword argument.", range=testitem_range))
92+
push!(testerrors, (name=node[2, 1].val, message="Unknown keyword argument.", range=testitem_range))
9393
return
9494
end
9595
end
9696

97-
if option_tags===nothing
97+
if option_tags === nothing
9898
option_tags = Symbol[]
9999
end
100100

101-
if option_default_imports===nothing
101+
if option_default_imports === nothing
102102
option_default_imports = true
103103
end
104104

105-
if option_setup===nothing
105+
if option_setup === nothing
106106
option_setup = Symbol[]
107107
end
108108

@@ -114,8 +114,8 @@ function find_test_detail!(node, testitems, testsetups, testerrors)
114114
end
115115

116116
push!(testitems,
117-
(
118-
name=node[2,1].val,
117+
(
118+
name=node[2, 1].val,
119119
range=testitem_range,
120120
code_range=code_range,
121121
option_default_imports=option_default_imports,
@@ -132,28 +132,28 @@ function find_test_detail!(node, testitems, testsetups, testerrors)
132132
child_nodes = children(node)
133133

134134
# Check for various syntax errors
135-
if length(child_nodes)==1
136-
push!(testerrors, (name = "Test definition error", message="Your $testkind is missing a name and code block.", range=testitem_range))
135+
if length(child_nodes) == 1
136+
push!(testerrors, (name="Test definition error", message="Your $testkind is missing a name and code block.", range=testitem_range))
137137
return
138-
elseif length(child_nodes)>1 && !(kind(child_nodes[2]) == K"Identifier")
139-
push!(testerrors, (name = "Test definition error", message="Your $testkind must have a first argument that is an identifier for the name.", range=testitem_range))
138+
elseif length(child_nodes) > 1 && !(kind(child_nodes[2]) == K"Identifier")
139+
push!(testerrors, (name="Test definition error", message="Your $testkind must have a first argument that is an identifier for the name.", range=testitem_range))
140140
return
141-
elseif length(child_nodes)==2
142-
push!(testerrors, (name = child_nodes[2].val, message="Your $testkind is missing a code block argument.", range=testitem_range))
141+
elseif length(child_nodes) == 2
142+
push!(testerrors, (name=child_nodes[2].val, message="Your $testkind is missing a code block argument.", range=testitem_range))
143143
return
144144
elseif !(kind(child_nodes[end]) == K"block")
145-
push!(testerrors, (name = child_nodes[2].val, message="The final argument of a $testkind must be a begin end block.", range=testitem_range))
145+
push!(testerrors, (name=child_nodes[2].val, message="The final argument of a $testkind must be a begin end block.", range=testitem_range))
146146
return
147147
else
148148
# Now check our keyword args
149149
for i in child_nodes[3:end-1]
150150
if kind(i) != K"="
151-
push!(testerrors, (name = child_nodes[2].val, message="The arguments to a $testkind must be in keyword format.", range=testitem_range))
151+
push!(testerrors, (name=child_nodes[2].val, message="The arguments to a $testkind must be in keyword format.", range=testitem_range))
152152
return
153-
elseif !(length(children(i))==2)
153+
elseif !(length(children(i)) == 2)
154154
error("This code path should not be possible.")
155155
else
156-
push!(testerrors, (name = child_nodes[2].val, message="Unknown keyword argument.", range=testitem_range))
156+
push!(testerrors, (name=child_nodes[2].val, message="Unknown keyword argument.", range=testitem_range))
157157
return
158158
end
159159
end
@@ -166,9 +166,9 @@ function find_test_detail!(node, testitems, testsetups, testerrors)
166166
(first(our_range(code_block))+5):(last(our_range(code_block))-3)
167167
end
168168

169-
testkind2 = if testkind==Symbol("@testmodule")
169+
testkind2 = if testkind == Symbol("@testmodule")
170170
:module
171-
elseif testkind==Symbol("@testsnippet")
171+
elseif testkind == Symbol("@testsnippet")
172172
:snippet
173173
else
174174
error("Unknown testkind")

0 commit comments

Comments
 (0)