diff options
| author | dkf <donal.k.fellows@manchester.ac.uk> | 2015-10-23 22:44:31 (GMT) |
|---|---|---|
| committer | dkf <donal.k.fellows@manchester.ac.uk> | 2015-10-23 22:44:31 (GMT) |
| commit | d1f3fe0de0e2a729b8e945e667ea1075cc10dcd8 (patch) | |
| tree | 53e0ed6f1bf22b896d797015c75e85d66c1700b8 | |
| parent | 828abac60a48802e4e4553d5ddc3683835fe05f8 (diff) | |
| parent | a29de0a577298c9b98bbd6e505c38cf0c9628be7 (diff) | |
| download | tcl-d1f3fe0de0e2a729b8e945e667ea1075cc10dcd8.zip tcl-d1f3fe0de0e2a729b8e945e667ea1075cc10dcd8.tar.gz tcl-d1f3fe0de0e2a729b8e945e667ea1075cc10dcd8.tar.bz2 | |
Mend problems with [platform::identify] formatting.
| -rw-r--r-- | library/platform/platform.tcl | 2 | ||||
| -rw-r--r-- | tests/platform.test | 13 |
2 files changed, 13 insertions, 2 deletions
diff --git a/library/platform/platform.tcl b/library/platform/platform.tcl index c596e60..0160184 100644 --- a/library/platform/platform.tcl +++ b/library/platform/platform.tcl @@ -165,7 +165,7 @@ proc ::platform::identify {} { global tcl_platform set id [generic] - regexp {^([^-]+)-([^-]+)$} $id -> plat ver wow cpu + regexp {^([^-]+)(-[0-9\.]+)?(-wow)?-([^-]+)$} $id -> plat ver wow cpu switch -- $plat { solaris { diff --git a/tests/platform.test b/tests/platform.test index 6596975..2b98975 100644 --- a/tests/platform.test +++ b/tests/platform.test @@ -1,4 +1,4 @@ -# The file tests the tcl_platform variable +# The file tests the tcl_platform variable and platform package. # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and @@ -57,6 +57,17 @@ test platform-3.1 {CPU ID on Windows/UNIX} \ -match regexp \ -result {^(?:AuthenticAMD|CentaurHauls|CyrixInstead|GenuineIntel)$} +# The platform package makes very few promises, but does promise that the +# format of string it produces consists of two non-empty words separated by a +# hyphen. +package require platform +test platform-4.1 {format of platform::identify result} -match regexp -body { + platform::identify +} -result {^[^-]+-[^-]+$} +test platform-4.2 {format of platform::generic result} -match regexp -body { + platform::generic +} -result {^[^-]+-[^-]+$} + # cleanup cleanupTests |
