home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / TCL / ITCL / _ITCL.TAR / usr / lib / itcl / tests / AAA.test next >
Encoding:
Text File  |  1994-03-21  |  3.0 KB  |  96 lines

  1. #
  2. # AAA - first test executed in test suite
  3. # ----------------------------------------------------------------------
  4. #   AUTHOR:  Michael J. McLennan       Phone: (610)712-2842
  5. #            AT&T Bell Laboratories   E-mail: michael.mclennan@att.com
  6. #
  7. #      RCS:  AAA.test,v 1.1.1.1 1994/03/21 22:09:50 mmc Exp
  8. # ----------------------------------------------------------------------
  9. #               Copyright (c) 1993  AT&T Bell Laboratories
  10. # ======================================================================
  11. # Permission to use, copy, modify, and distribute this software and its
  12. # documentation for any purpose and without fee is hereby granted,
  13. # provided that the above copyright notice appear in all copies and that
  14. # both that the copyright notice and warranty disclaimer appear in
  15. # supporting documentation, and that the names of AT&T Bell Laboratories
  16. # any of their entities not be used in advertising or publicity
  17. # pertaining to distribution of the software without specific, written
  18. # prior permission.
  19. #
  20. # AT&T disclaims all warranties with regard to this software, including
  21. # all implied warranties of merchantability and fitness.  In no event
  22. # shall AT&T be liable for any special, indirect or consequential
  23. # damages or any damages whatsoever resulting from loss of use, data or
  24. # profits, whether in an action of contract, negligence or other
  25. # tortuous action, arising out of or in connection with the use or
  26. # performance of this software.
  27. # ======================================================================
  28.  
  29. # ----------------------------------------------------------------------
  30. #  SHOULD HAVE A CLEAN SLATE
  31. # ----------------------------------------------------------------------
  32. test {No object info (no classes)} {
  33.     itcl_info classes
  34. } {
  35.     $result == ""
  36. }
  37.  
  38. test {No object info (no objects)} {
  39.     itcl_info objects
  40. } {
  41.     $result == ""
  42. }
  43.  
  44. # ----------------------------------------------------------------------
  45. #  TEST CLASS AUTO-LOADING
  46. # ----------------------------------------------------------------------
  47. test {Force auto-loading through inheritance} {
  48.     FooBar x
  49. } {
  50.     $result == "x"
  51. }
  52.  
  53. test {Info: all classes} {
  54.     itcl_info classes
  55. } {
  56.     [test_cmp_lists $result {Foo Bar FooBar}]
  57. }
  58.  
  59. test {Info: all classes matching a pattern} {
  60.     itcl_info classes *oo*
  61. } {
  62.     [test_cmp_lists $result {Foo FooBar}]
  63. }
  64.  
  65. # ----------------------------------------------------------------------
  66. #  OBJECT AUTO-NUMBERING
  67. # ----------------------------------------------------------------------
  68. test {Create object with auto-naming} {
  69.     FooBar #auto -blit x
  70. } {
  71.     $result == "FooBar0" && [FooBar0 info public blit -value] == "x"
  72. }
  73.  
  74. test {Create object with auto-naming} {
  75.     FooBar #auto -blit y
  76. } {
  77.     $result == "FooBar1" && [FooBar1 info public blit -value] == "y"
  78. }
  79.  
  80. test {Auto-naming should avoid names already in use} {
  81.     FooBar FooBar2
  82.     FooBar FooBar3
  83.     FooBar FooBar4
  84.     FooBar #auto
  85. } {
  86.     $result == "FooBar5"
  87. }
  88.  
  89. test {Destroy all outstanding objects} {
  90.     foreach obj [itcl_info objects] {
  91.         $obj delete
  92.     }
  93. } {
  94.     $result == ""
  95. }
  96.