Blame tests/upstream-test-suite/062_namespace_resolution.tcl

Than Ngo b7bcaa
#// objective: tests correct namespace resolution, only references/referencedby relations are relevant
Than Ngo b7bcaa
#// check: namespacen1.xml
Than Ngo b7bcaa
#// check: namespacen2.xml
Than Ngo b7bcaa
#// check: namespacen3.xml
Than Ngo b7bcaa
#// config: REFERENCED_BY_RELATION = yes
Than Ngo b7bcaa
#// config: REFERENCES_RELATION = yes
Than Ngo b7bcaa
#// config: EXTRACT_ALL = yes
Than Ngo b7bcaa
#// config: INLINE_SOURCES = yes
Than Ngo b7bcaa
Than Ngo b7bcaa
# now: combine namespace eval and qualified names
Than Ngo b7bcaa
namespace eval n1 {
Than Ngo b7bcaa
    proc p1 args {
Than Ngo b7bcaa
        array set info [info frame 0]; puts -nonewline ->$info(proc)
Than Ngo b7bcaa
        p2
Than Ngo b7bcaa
        return
Than Ngo b7bcaa
    }
Than Ngo b7bcaa
    proc p2 args {
Than Ngo b7bcaa
        array set info [info frame 0]; puts -nonewline ->$info(proc)
Than Ngo b7bcaa
        return
Than Ngo b7bcaa
    }
Than Ngo b7bcaa
    namespace eval n1 {
Than Ngo b7bcaa
        proc p1 args {
Than Ngo b7bcaa
            array set info [info frame 0]; puts -nonewline ->$info(proc)
Than Ngo b7bcaa
            return
Than Ngo b7bcaa
        }
Than Ngo b7bcaa
    }
Than Ngo b7bcaa
}
Than Ngo b7bcaa
# same thing, but fully qualified proc names
Than Ngo b7bcaa
namespace eval ::n2 {}
Than Ngo b7bcaa
namespace eval ::n2::n2 {}
Than Ngo b7bcaa
proc ::n2::p1 args {
Than Ngo b7bcaa
    array set info [info frame 0]; puts -nonewline ->$info(proc)
Than Ngo b7bcaa
    p2
Than Ngo b7bcaa
    return
Than Ngo b7bcaa
}
Than Ngo b7bcaa
proc ::n2::p2 args {
Than Ngo b7bcaa
    array set info [info frame 0]; puts -nonewline ->$info(proc)
Than Ngo b7bcaa
    return
Than Ngo b7bcaa
}
Than Ngo b7bcaa
proc ::n2::n2::p2 args {
Than Ngo b7bcaa
    array set info [info frame 0]; puts -nonewline ->$info(proc)
Than Ngo b7bcaa
    return
Than Ngo b7bcaa
}
Than Ngo b7bcaa
# same thing, without leading ::
Than Ngo b7bcaa
namespace eval n3 {}
Than Ngo b7bcaa
namespace eval n3::n3 {}
Than Ngo b7bcaa
proc n3::p1 args {
Than Ngo b7bcaa
    array set info [info frame 0]; puts -nonewline ->$info(proc)
Than Ngo b7bcaa
    p2
Than Ngo b7bcaa
    return
Than Ngo b7bcaa
}
Than Ngo b7bcaa
proc n3::p2 args {
Than Ngo b7bcaa
    array set info [info frame 0]; puts -nonewline ->$info(proc)
Than Ngo b7bcaa
    return
Than Ngo b7bcaa
}
Than Ngo b7bcaa
proc n3::n3::p2 args {
Than Ngo b7bcaa
    array set info [info frame 0]; puts -nonewline ->$info(proc)
Than Ngo b7bcaa
    return
Than Ngo b7bcaa
}
Than Ngo b7bcaa
# now, check with tcl what is called
Than Ngo b7bcaa
n1::p1
Than Ngo b7bcaa
puts ""
Than Ngo b7bcaa
n2::p1
Than Ngo b7bcaa
puts ""
Than Ngo b7bcaa
n3::p1
Than Ngo b7bcaa
puts ""
Than Ngo b7bcaa
exit
Than Ngo b7bcaa