Diff
Not logged in

Differences From Artifact [a522851f8a]:

To Artifact [3c6e15bb04]:


9
10
11
12
13
14
15
16

17
18
19
20
21
22
23
9
10
11
12
13
14
15

16
17
18
19
20
21
22
23







-
+







# Copyright (c) 1994-1997 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
# Copyright (c) 2006      ActiveState
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: info.test,v 1.43 2006/12/17 03:43:40 das Exp $
# RCS: @(#) $Id: info.test,v 1.44 2007/05/18 18:39:31 dgp Exp $

if {[lsearch [namespace children] ::tcltest] == -1} {
    package require tcltest 2
    namespace import -force ::tcltest::*
}

# Set up namespaces needed to test operation of "info args", "info body",
1062
1063
1064
1065
1066
1067
1068
1069

1070
1071
1072
1073
1074

1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085

1086
1087
1088
1089
1090

1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106


1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122

1123
1124

1125
1126
1127
1128
1129
1130
1131
1062
1063
1064
1065
1066
1067
1068

1069
1070
1071
1072
1073

1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084

1085
1086
1087
1088
1089

1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104


1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121

1122
1123

1124
1125
1126
1127
1128
1129
1130
1131







-
+




-
+










-
+




-
+














-
-
+
+















-
+

-
+







    reduce [foo::bar]
} {type proc line 1 cmd {info frame 0} proc ::foo::bar level 0}

namespace delete foo

# -------------------------------------------------------------------------

namespace {expand}{
namespace {*}{
    eval
    foo
    {proc bar {} {info frame 0}}
}
test info-33.0 {expand, literal, direct} {
test info-33.0 {{*}, literal, direct} {
    reduce [foo::bar]
} {type source line 1072 file info.test cmd {info frame 0} proc ::foo::bar level 0}

namespace delete foo

# -------------------------------------------------------------------------

namespace eval foo {}
proc foo::bar {} {
    set flag 1
    if {expand}{
    if {*}{
	{$flag}
	{info frame 0}
    }
}
test info-33.1 {expand, literal, simple, bytecompiled} {
test info-33.1 {{*}, literal, simple, bytecompiled} {
    reduce [foo::bar]
} {type source line 1087 file info.test cmd {info frame 0} proc ::foo::bar level 0}

namespace delete foo

# -------------------------------------------------------------------------

set body {
    eval
    foo
    {proc bar {} {
	info frame 0
    }}
}
namespace {expand}$body
test info-34.0 {expand, dynamic, direct} {
namespace {*}$body
test info-34.0 {{*}, dynamic, direct} {
    reduce [foo::bar]
} {type proc line 2 cmd {info frame 0} proc ::foo::bar level 0}

unset body
namespace delete foo

# -------------------------------------------------------------------------

namespace eval foo {}
set body {
    {$flag}
    {info frame 0}
}
proc foo::bar {} {
    global body ; set flag 1
    if {expand}$body
    if {*}$body
}
test info-34.1 {expand, literal, bytecompiled} {
test info-34.1 {{*}, literal, bytecompiled} {
    reduce [foo::bar]
} {type eval line 1 cmd {info frame 0} proc ::foo::bar level 0}

unset body
namespace delete foo

# -------------------------------------------------------------------------
1244
1245
1246
1247
1248
1249
1250
1251

1252
1253
1254
1255
1256

1257
1258
1259
1260
1261
1262
1263
1264

1265
1266

1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277

1278
1279
1280
1281
1282

1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293

1294
1295

1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1244
1245
1246
1247
1248
1249
1250

1251
1252
1253
1254
1255

1256
1257
1258
1259
1260
1261
1262
1263

1264
1265

1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276

1277
1278
1279
1280
1281

1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292

1293
1294

1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306







-
+




-
+







-
+

-
+










-
+




-
+










-
+

-
+











    reduce [foo::bar]
} {type source line 1239 file info.test cmd {info frame 0} proc ::foo::bar level 0}

namespace delete foo

# -------------------------------------------------------------------------

namespace {expand}"
namespace {*}"
    eval
    foo
    {proc bar {} {info frame 0}}
"
test info-33.2 {expand, literal, direct} {
test info-33.2 {{*}, literal, direct} {
    reduce [foo::bar]
} {type source line 1254 file info.test cmd {info frame 0} proc ::foo::bar level 0}

namespace delete foo

# -------------------------------------------------------------------------

namespace {expand}"eval\nfoo\n{proc bar {} {info frame 0}}\n"
namespace {*}"eval\nfoo\n{proc bar {} {info frame 0}}\n"

test info-33.2a {expand, literal, not simple, direct} {
test info-33.2a {{*}, literal, not simple, direct} {
    reduce [foo::bar]
} {type proc line 1 cmd {info frame 0} proc ::foo::bar level 0}

namespace delete foo

# -------------------------------------------------------------------------

namespace eval foo {}
proc foo::bar {} {
    set flag 1
    if {expand}"
    if {*}"
	{1}
	{info frame 0}
    "
}
test info-33.3 {expand, literal, simple, bytecompiled} {
test info-33.3 {{*}, literal, simple, bytecompiled} {
    reduce [foo::bar]
} {type source line 1279 file info.test cmd {info frame 0} proc ::foo::bar level 0}

namespace delete foo

# -------------------------------------------------------------------------

namespace eval foo {}
proc foo::bar {} {
    set flag 1
    if {expand}"\n{1}\n{info frame 0}"
    if {*}"\n{1}\n{info frame 0}"
}
test info-33.3a {expand, literal, not simple, bytecompiled} {
test info-33.3a {{*}, literal, not simple, bytecompiled} {
    reduce [foo::bar]
} {type eval line 1 cmd {info frame 0} proc ::foo::bar level 0}

namespace delete foo

# -------------------------------------------------------------------------

# cleanup
catch {namespace delete test_ns_info1 test_ns_info2}
::tcltest::cleanupTests
return