summaryrefslogtreecommitdiffstats
path: root/testing/062_namespace_resolution.tcl
blob: dcc67014f850cf0655a5dbd29563a6b977a16fa5 (plain)
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
#// objective: tests correct namespace resolution, only references/referencedby relations are relevant
#// check: namespacen1.xml
#// check: namespacen2.xml
#// check: namespacen3.xml
#// config: REFERENCED_BY_RELATION = yes
#// config: REFERENCES_RELATION = yes
#// config: EXTRACT_ALL = yes
#// config: INLINE_SOURCES = yes

# now: combine namespace eval and qualified names
namespace eval n1 {
    proc p1 args {
        array set info [info frame 0]; puts -nonewline ->$info(proc)
        p2
        return
    }
    proc p2 args {
        array set info [info frame 0]; puts -nonewline ->$info(proc)
        return
    }
    namespace eval n1 {
        proc p1 args {
            array set info [info frame 0]; puts -nonewline ->$info(proc)
            return
        }
    }
}
# same thing, but fully qualified proc names
namespace eval ::n2 {}
namespace eval ::n2::n2 {}
proc ::n2::p1 args {
    array set info [info frame 0]; puts -nonewline ->$info(proc)
    p2
    return
}
proc ::n2::p2 args {
    array set info [info frame 0]; puts -nonewline ->$info(proc)
    return
}
proc ::n2::n2::p2 args {
    array set info [info frame 0]; puts -nonewline ->$info(proc)
    return
}
# same thing, without leading ::
namespace eval n3 {}
namespace eval n3::n3 {}
proc n3::p1 args {
    array set info [info frame 0]; puts -nonewline ->$info(proc)
    p2
    return
}
proc n3::p2 args {
    array set info [info frame 0]; puts -nonewline ->$info(proc)
    return
}
proc n3::n3::p2 args {
    array set info [info frame 0]; puts -nonewline ->$info(proc)
    return
}
# now, check with tcl what is called
n1::p1
puts ""
n2::p1
puts ""
n3::p1
puts ""
exit