tcltest - How to get test name inside test command

The tcltest command is a great tool for doing regression testing however the command doesn't provide access to the test name within the body of the test command. This problem can be solved using the info frame ... command as shown in the example code below. -- tjk

package require tcltest
namespace import -force ::tcltest::*

proc test_name { } {
        set frame [dict create {*}[info frame 1]]
        return [lindex [dict get $frame cmd] 1]
}


test test-1.0 {check test_name command} -constraints {
} -setup {
} -body {
        set fpath [file join [pwd] [test_name].txt]
        set fid [open $fpath w]
        puts $fid "HELLO WORLD"
        close $fid
        return
} -result {} \
-output {} \
-match exact \
-cleanup {}

Which produces a file named test-1.0.txt in the local directory that contains HELLO WORLD.