You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.7 KiB
49 lines
1.7 KiB
package require tcltest |
|
package require punk::args |
|
|
|
namespace eval ::testspace { |
|
namespace import ::tcltest::* |
|
tcltest::testConstraint punkargsKnownBug 0 |
|
|
|
variable common { |
|
set result "" |
|
} |
|
|
|
#pin flipped 2026-07-17: punk::args 0.12.5 bypasses the parse -cache for @dynamic |
|
#definitions, so re-evaluated substitutions always take effect. |
|
test define_dynamic_cache_refreshes_resolved_defaults {@dynamic defaults refresh when parsed with -cache 1 (cache bypassed for dynamic definitions)}\ |
|
-setup $common -body { |
|
variable test_list |
|
set test_list {A B C} |
|
proc ::testspace::get_list {} { |
|
variable test_list |
|
return $test_list |
|
} |
|
namespace eval whatever { |
|
set DYN_LIST {${[::testspace::get_list]}} |
|
|
|
punk::args::define { |
|
@dynamic |
|
@id -id ::testspace::test_dynamic_cache |
|
@values |
|
param -type list -default "${$DYN_LIST}" |
|
} |
|
} |
|
|
|
set argd [punk::args::parse {} -cache 1 withid ::testspace::test_dynamic_cache] |
|
lappend result [dict get $argd values param] |
|
|
|
set ::testspace::test_list {X Y Z} |
|
set argd [punk::args::parse {} -cache 1 withid ::testspace::test_dynamic_cache] |
|
lappend result [dict get $argd values param] |
|
}\ |
|
-cleanup { |
|
namespace delete ::testspace::whatever |
|
rename ::testspace::get_list {} |
|
punk::args::undefine ::testspace::test_dynamic_cache |
|
}\ |
|
-result [list\ |
|
{A B C} {X Y Z} |
|
] |
|
} |
|
tcltest::cleanupTests ;#needed to produce test summary line. |