File: bug_fixes.test

package info (click to toggle)
tcllib 2.0%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 83,560 kB
  • sloc: tcl: 306,798; ansic: 14,272; sh: 3,035; xml: 1,766; yacc: 1,157; pascal: 881; makefile: 124; perl: 84; f90: 84; python: 33; ruby: 13; php: 11
file content (162 lines) | stat: -rw-r--r-- 5,276 bytes parent folder | download | duplicates (2)
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
##########################################################################
# 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.5
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"

######## Bug a0e091b25d of tepam 0.5.0: Misformatted description in auto-generated help text ######

   namespace eval ::bug {
      tepam::procedure {tproc subproc1} {
         -description "desc1."
      } {}
      
      tepam::procedure {tproc subproc2} {
         -description "desc2."
      } {}
      
      tepam::procedure {tproc subproc3} {
         -description "desc 3."
      } {}
      
      tepam::procedure {tproc subproc4} {
         -description "desc 4."
      } {}
      
      tepam::procedure {tproc subproc5} {
         -description "desc 5."
      } {}
   }

   tcltest::test tepam-bug_fixes.bug3613644.1 "Bug fixes, bug 3613644 (1)"  \
      -body {::bug::tproc -help} \
      -result "" -output [join {
         {NAME}
         {      bug::tproc}
         {SYNOPSIS}
         {      bug::tproc subproc1}
         {      bug::tproc subproc2}
         {      bug::tproc subproc3}
         {      bug::tproc subproc4}
         {      bug::tproc subproc5}
         {DESCRIPTION}
         {      bug::tproc subproc1}
         {         desc1.}
         {      bug::tproc subproc2}
         {         desc2.}
         {      bug::tproc subproc3}
         {         desc 3.}
         {      bug::tproc subproc4}
         {         desc 4.}
         {      bug::tproc subproc5}
         {         desc 5.}
         {} {}
      } "\n"]
   
######## That's all ########

::tcltest::cleanupTests
return

##########################################################################
# Id: bug_fixes.test
# Modifications:
#
# Revision 2016/03/04 droll
# * Added test for reported bug a0e091b25d (Misformatted description in auto-generated help text)
#
# Revision 2013/10/14 droll
# * Added test for reported bug 3613644
#
# Revision 2013/03/25 droll
# * New test file, added tests to verify bug 3608951
##########################################################################