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 | fa55d6d012bbf4fb7847db0a29710fa0bcd15d5c (patch) | |
tree | 53e0ed6f1bf22b896d797015c75e85d66c1700b8 | |
parent | 31aafac92405d7c54cdb4615d1eed6dd9362c4f9 (diff) | |
parent | 357ca2067d11e6a7520d106c5b06158caeecdf5b (diff) | |
download | tcl-fa55d6d012bbf4fb7847db0a29710fa0bcd15d5c.zip tcl-fa55d6d012bbf4fb7847db0a29710fa0bcd15d5c.tar.gz tcl-fa55d6d012bbf4fb7847db0a29710fa0bcd15d5c.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 |