File tree Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 216
216
217
217
" Test for function definition expressions."
218
218
isdef (ex) = ismatch (or_ (:(function _ (__) _ end ),
219
- :(f_ (__) = _)),
219
+ :(function _ (__):: _ _ end ),
220
+ :(f_ (__) = _),
221
+ :(f_ (__):: _ = _)),
220
222
ex)
221
223
222
224
isshortdef (ex) = (@capture (ex, (fcall_ = body_)) &&
Original file line number Diff line number Diff line change @@ -6,5 +6,6 @@ using Test
6
6
include (" match.jl" )
7
7
include (" split.jl" )
8
8
include (" destruct.jl" )
9
+ include (" utils.jl" )
9
10
10
11
end
Original file line number Diff line number Diff line change
1
+ using MacroTools: isdef
2
+
3
+ @testset " utils" begin
4
+ ex1 = :(function foo (a) return a; end )
5
+ @test isdef (ex1)
6
+ ex2 = :(function bar (a):: Int return 1 ; end )
7
+ @test isdef (ex2)
8
+ ex3 = :(f (a) = a)
9
+ @test isdef (ex3)
10
+ ex4 = :(f (a):: Int = 1 )
11
+ @test isdef (ex4)
12
+ end
You can’t perform that action at this time.
0 commit comments