From 905f8b73d720bf9b2bff9c36d225236cf7735778 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 21 Aug 2025 14:00:13 +0000 Subject: Add testcases --- tests/platform.test | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/tests/platform.test b/tests/platform.test index 33aea3a..e11b72d 100644 --- a/tests/platform.test +++ b/tests/platform.test @@ -34,7 +34,6 @@ test platform-1.0 {tcl_platform(engine)} { test platform-1.1 {TclpSetVariables: tcl_platform} { interp create i i eval {catch {unset tcl_platform(debug)}} - i eval {catch {unset tcl_platform(threaded)}} set result [i eval {lsort [array names tcl_platform]}] interp delete i set result @@ -72,6 +71,34 @@ test platform-4.2 {format of platform::generic result} -match regexp -body { platform::generic } -result {^([^-]+-)+[^-]+$} +test platform-5.0 {format of platform::generic result} -setup { + set old_machine $::tcl_platform(machine) + set old_os $::tcl_platform(os) + set old_wordsize $::tcl_platform(wordSize) + set old_version $tcl_platform(osVersion) + set ::tcl_platform(machine) arm + set ::tcl_platform(os) Darwin + set ::tcl_platform(wordSize) 8 +} -body { + set res {} + set l {macosx10.15-x86_64 macosx10.14-x86_64 macosx10.13-x86_64 macosx10.12-x86_64 macosx10.11-x86_64 macosx10.10-x86_64 macosx10.9-x86_64 tcl} + foreach v {20.0 21.0 22.0 23.0 24.0 25.0 26.0} { + set ::tcl_platform(osVersion) $v + set id [platform::identify] + set l [linsert $l 0 [string range $id 0 end-4]-x86_64] + set l [linsert $l 0 $id] + lappend res $id + lappend res [expr {($l eq [platform::patterns $id]) ? 1 : [platform::patterns $id]}] + } + set res +} -cleanup { + set ::tcl_platform(machine) $old_machine + set ::tcl_platform(os) $old_os + set ::tcl_platform(wordSize) $old_wordsize + set ::tcl_platform(osVersion) $old_version + unset res l old_machine old_os old_wordsize old_version +} -result {macos11-arm 1 macos12-arm 1 macos13-arm 1 macos14-arm 1 macos15-arm 1 macos26-arm 1 macos27-arm 1} + # cleanup cleanupTests -- cgit v0.12