summaryrefslogtreecommitdiffstats
path: root/tcllib/modules/tepam/bug_fixes.test
blob: ae5a10bca2b3f5f6f7af653a69c5c6148b0a11ac (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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
##########################################################################
# TEPAM - Tcl's Enhanced Procedure and Argument Manager
##########################################################################
#
# bug_fixes.test:
# This file is part of the enhanced procedure and argument manager's regression
# test. It validates the fix of various bugs
#
# Copyright (C) 2013 Andreas Drollinger
# 
# Id: bug_fixes.test
##########################################################################
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
##########################################################################

source [file join \
   [file dirname [file dirname [file join [pwd] [info script]]]] \
   devtools testutilities.tcl]

testsNeedTcl     8.3
testsNeedTcltest 1.0

catch {namespace delete ::tepam}
testing {
   useLocal tepam.tcl tepam
}
set tepam::named_arguments_first 0

######## Bug 3608951 of tepam 0.4.0: Order of the arguments in the generated help text ########

   tepam::procedure Procedure_named_arg_first1 {
      -named_arguments_first 1
      -args {-Named1 -Named2 Unnamed1 Unnamed2}
   } {}

   tepam::procedure Procedure_named_arg_first2 {
      -named_arguments_first 1
      -args {Unnamed1 Unnamed2 -Named1 -Named2}
   } {}

   tepam::procedure Procedure_unnamed_arg_first1 {
      -named_arguments_first 0
      -args {-Named1 -Named2 Unnamed1 Unnamed2}
   } {}

   tepam::procedure Procedure_unnamed_arg_first2 {
      -named_arguments_first 0
      -args {Unnamed1 Unnamed2 -Named1 -Named2}
   } {}

   test tepam-bug_fixes.help_text.nun1 "Bug fixes, NUN"  \
      -body "Procedure_named_arg_first1 -help" \
      -match glob \
      -result "" -output "*Procedure_named_arg_first1*-Named1 <Named1>*-Named2 <Named2>*<Unnamed1>*<Unnamed2>*"

      test tepam-bug_fixes.help_text.nun2 "Bug fixes, NUN"  \
      -body "Procedure_named_arg_first2 -help" \
      -match glob \
      -result "" -output "*Procedure_named_arg_first2*-Named1 <Named1>*-Named2 <Named2>*<Unnamed1>*<Unnamed2>*"

   test tepam-bug_fixes.help_text.unn1 "Bug fixes, unn"  \
      -body "Procedure_unnamed_arg_first1 -help" \
      -match glob \
      -result "" -output "*Procedure_unnamed_arg_first1*<Unnamed1>*<Unnamed2>*-Named1 <Named1>*-Named2 <Named2>*"

   test tepam-bug_fixes.help_text.unn2 "Bug fixes, unn"  \
      -body "Procedure_unnamed_arg_first2 -help" \
      -match glob \
      -result "" -output "*Procedure_unnamed_arg_first2*<Unnamed1>*<Unnamed2>*-Named1 <Named1>*-Named2 <Named2>*"

######## Bug 3608952 of tepam 0.4.0: Help text is incorrect if procedure is part of non-default namespace ######

# This bug is verified by the updated test 'proc_namespaces.test'.

######## Bug 3613644 of tepam 0.4.0: Incorrect namespace formatting results in no vars defined ######

   namespace eval myns {
      tepam::procedure myproc {
         -args {
            {-myvar -default myvalue}
         }
      } {
         return $myvar
      }
   }

   test tepam-bug_fixes.bug3613644.1 "Bug fixes, bug 3613644 (1)"  \
      -body {puts "first try: [::myns::myproc]"} \
      -result "" -output "first try: myvalue\n"

   test tepam-bug_fixes.bug3613644.2 "Bug fixes, bug 3613644 (2)"  \
      -body {puts "second try: [myns::myproc]"} \
      -result "" -output "second try: myvalue\n"
     
######## That's all ########

::tcltest::cleanupTests
return

##########################################################################
# Id: bug_fixes.test
# Modifications:
#
# Revision 1.2  2013/10/14 droll
# * Added test for reported bug 3613644
#
# Revision 1.1  2013/03/25 droll
# * New test file, added tests to verify bug 3608951
##########################################################################