-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmetamodule.jl
49 lines (29 loc) · 868 Bytes
/
metamodule.jl
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
module MetaModuleTests
using Base.Test
#-----------------------------------------------------------------------------------
module A
using ExpressionPatterns.Dispatch
@metamodule export @f,@g
@macromethod f(x) 1
@macromethod g(x) 1
end
#-----------------------------------------------------------------------------------
module B
using ExpressionPatterns.Dispatch
@metamodule import ..A.@f
@macromethod f(x+y) 2
@macromethod g(x+y) 2
end
#-----------------------------------------------------------------------------------
module C
using ExpressionPatterns.Dispatch
@metamodule importall ..A
@macromethod f(x-y) 3
@macromethod g(x-y) 3
end
#-----------------------------------------------------------------------------------
@test A.@f(x+y) == B.@f(x+y)
@test A.@g(x+y) != B.@g(x+y)
@test A.@f(x-y) == C.@f(x-y)
@test A.@f(x-y) == C.@f(x-y)
end