OSDN Git Service

Please enter the commit message for your changes. Lines starting
[eos/base.git] / util / src / TclTk / tcl8.6.12 / pkgs / itcl4.2.2 / tests / mkindex.test
1 #
2 # Tests for "auto_mkindex" and autoloading facility
3 # ----------------------------------------------------------------------
4 #   AUTHOR:  Michael J. McLennan
5 #            Bell Labs Innovations for Lucent Technologies
6 #            mmclennan@lucent.com
7 #            http://www.tcltk.com/itcl
8 # ----------------------------------------------------------------------
9 #            Copyright (c) 1993-1998  Lucent Technologies, Inc.
10 # ======================================================================
11 # See the file "license.terms" for information on usage and
12 # redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
13
14 package require tcltest 2.1
15 namespace import ::tcltest::test
16 set ::tcl::inl_mem_test 0
17 ::tcltest::loadTestedCommands
18 package require itcl
19
20 # ----------------------------------------------------------------------
21 #  Test "auto_mkindex" in the presence of class definitions
22 # ----------------------------------------------------------------------
23 test mkindex-1.1 {remove any existing tclIndex file} {
24     file delete tclIndex
25     file exists tclIndex
26 } {0}
27
28 test mkindex-1.2 {build tclIndex based on a test file} {
29     if {[pwd] != $::tcltest::testsDirectory} {
30         file copy -force [file join $::tcltest::testsDirectory mkindex.itcl] \
31                 ./mkindex.itcl
32     }
33     auto_mkindex . mkindex.itcl
34     if {[pwd] != $::tcltest::testsDirectory} {
35         file delete -force ./mkindex.itcl
36     }
37     file exists tclIndex
38 } {1}
39
40 set element "{source [file join . mkindex.itcl]}"
41
42 test mkindex-1.3 {examine tclIndex} {
43     namespace eval itcl_mkindex_tmp {
44         set dir "."
45         variable auto_index
46         source tclIndex
47         set result ""
48         foreach elem [lsort [array names auto_index]] {
49             lappend result [list $elem $auto_index($elem)]
50         }
51         set result
52     }
53 } "{::Simple2::bump $element} {::Simple2::by $element} {::buried::deep::within $element} {::buried::ens $element} {::buried::inside $element} {::buried::inside::bump $element} {::buried::inside::by $element} {::buried::inside::find $element} {::buried::under::neath $element} {::top::find $element} {::top::notice $element} {Simple1 $element} {Simple2 $element} {ens $element} {top $element}"
54
55 file delete tclIndex
56 ::tcltest::cleanupTests
57 return