aboutsummaryrefslogtreecommitdiff
path: root/tests/infoframe.test
blob: 949058990efbb2738f89b76956c36d37e8cf6fb6 (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
source [file dirname [info script]]/testing.tcl
needs constraint jim
proc a {n} {
	if {$n eq "trace"} {
		# strip the frame levels for test and uplevel
		return [basename-stacktrace [lrange [stacktrace] 0 end-6]]
	}
	set frame [info frame $n]; list [dict getdef $frame proc {}] [file tail [dict get $frame file]] [dict get $frame line]
}

proc b {n} {
	a $n
}

proc c {n} {
	b $n
}

# --- Don't change line numbers above

test info-frame-1.1 "Current command" {
	c 0
} {a infoframe.test 8}

test info-frame-1.2 "Current Proc" {
	c -1
} {b infoframe.test 12}

test info-frame-1.3 "Caller" {
	c -2
} {c infoframe.test 16}

test info-frame-1.4 "Caller of Caller" {
	c -3
} {test infoframe.test 34}

test stacktrace-1.1 "Full stack trace" {
	c trace
} {a infoframe.test 12 b infoframe.test 16 c infoframe.test 38}

testreport