os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/msgcat.test
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/msgcat.test	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,589 @@
     1.4 +# This file contains a collection of tests for the msgcat package.
     1.5 +# Sourcing this file into Tcl runs the tests and
     1.6 +# generates output for errors.  No output means no errors were found.
     1.7 +#
     1.8 +# Copyright (c) 1998 Mark Harrison.
     1.9 +# Copyright (c) 1998-1999 by Scriptics Corporation.
    1.10 +# Contributions from Don Porter, NIST, 2002.  (not subject to US copyright)
    1.11 +#
    1.12 +# See the file "license.terms" for information on usage and redistribution
    1.13 +# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
    1.14 +#
    1.15 +# Note that after running these tests, entries will be left behind in the
    1.16 +# message catalogs for locales foo, foo_BAR, and foo_BAR_baz.
    1.17 +#
    1.18 +# RCS: @(#) $Id: msgcat.test,v 1.11.2.4 2006/09/11 16:15:12 andreas_kupries Exp $
    1.19 +
    1.20 +package require Tcl 8.2
    1.21 +if {[catch {package require tcltest 2}]} {
    1.22 +    puts stderr "Skipping tests in [info script].  tcltest 2 required."
    1.23 +    return
    1.24 +}
    1.25 +if {[catch {package require msgcat 1.3.4}]} {
    1.26 +    puts stderr "Skipping tests in [info script].  No msgcat 1.3.4 found to test."
    1.27 +    return
    1.28 +}
    1.29 +
    1.30 +namespace eval ::msgcat::test {
    1.31 +    namespace import ::msgcat::*
    1.32 +    namespace import ::tcltest::test
    1.33 +    namespace import ::tcltest::cleanupTests
    1.34 +    namespace import ::tcltest::temporaryDirectory
    1.35 +    namespace import ::tcltest::make*
    1.36 +    namespace import ::tcltest::remove*
    1.37 +
    1.38 +    # Tests msgcat-0.*: locale initialization
    1.39 +
    1.40 +    proc PowerSet {l} {
    1.41 +	if {[llength $l] == 0} {return [list [list]]}
    1.42 +	set element [lindex $l 0]
    1.43 +	set rest [lrange $l 1 end]
    1.44 +	set result [list]
    1.45 +	foreach x [PowerSet $rest] {
    1.46 +	    lappend result [linsert $x 0 $element]
    1.47 +	    lappend result $x
    1.48 +	}
    1.49 +	return $result
    1.50 +    }
    1.51 +
    1.52 +    variable envVars {LC_ALL LC_MESSAGES LANG}
    1.53 +    variable count 0
    1.54 +    variable body
    1.55 +    variable result
    1.56 +    variable setVars
    1.57 +    foreach setVars [PowerSet $envVars] { 
    1.58 +	set result [string tolower [lindex $setVars 0]]
    1.59 +	if {[string length $result] == 0} {
    1.60 +	    if {[info exists ::tcl::mac::locale]} {
    1.61 +		set result [string tolower $::tcl::mac::locale]
    1.62 +	    } else {
    1.63 +		set result c
    1.64 +	    }
    1.65 +	}
    1.66 +	test msgcat-0.$count [list \
    1.67 +	    locale initialization from environment variables $setVars \
    1.68 +	] -setup {
    1.69 +	    variable var
    1.70 +	    foreach var $envVars {
    1.71 +		catch {variable $var $::env($var)}
    1.72 +		catch {unset ::env($var)}
    1.73 +	    }
    1.74 +	    foreach var $setVars {
    1.75 +		set ::env($var) $var
    1.76 +	    }
    1.77 +	    interp create [namespace current]::i
    1.78 +	    i eval [list package ifneeded msgcat [package provide msgcat] \
    1.79 +		    [package ifneeded msgcat [package provide msgcat]]]
    1.80 +	    i eval package require msgcat
    1.81 +	} -cleanup {
    1.82 +	    interp delete [namespace current]::i
    1.83 +	    foreach var $envVars {
    1.84 +		catch {unset ::env($var)}
    1.85 +		catch {set ::env($var) [set [namespace current]::$var]}
    1.86 +	    }
    1.87 +	} -body {i eval msgcat::mclocale} -result $result
    1.88 +	incr count
    1.89 +    }
    1.90 +    catch {unset result}
    1.91 +    
    1.92 +    # Could add tests of initialization from Windows registry here.
    1.93 +    # Use a fake registry package.
    1.94 +
    1.95 +    # Tests msgcat-1.*: [mclocale], [mcpreferences]
    1.96 +
    1.97 +    test msgcat-1.3 {mclocale set, single element} -setup {
    1.98 +	variable locale [mclocale]
    1.99 +    } -cleanup {
   1.100 +	mclocale $locale
   1.101 +    } -body {
   1.102 +	mclocale en
   1.103 +    } -result en
   1.104 +
   1.105 +    test msgcat-1.4 {mclocale get, single element} -setup {
   1.106 +	variable locale [mclocale]
   1.107 +	mclocale en
   1.108 +    } -cleanup {
   1.109 +	mclocale $locale
   1.110 +    } -body {
   1.111 +	mclocale
   1.112 +    } -result en
   1.113 +
   1.114 +    test msgcat-1.5 {mcpreferences, single element} -setup {
   1.115 +	variable locale [mclocale]
   1.116 +	mclocale en
   1.117 +    } -cleanup {
   1.118 +	mclocale $locale
   1.119 +    } -body {
   1.120 +	mcpreferences
   1.121 +    } -result en
   1.122 +
   1.123 +    test msgcat-1.6 {mclocale set, two elements} -setup {
   1.124 +	variable locale [mclocale]
   1.125 +    } -cleanup {
   1.126 +	mclocale $locale
   1.127 +    } -body {
   1.128 +	mclocale en_US
   1.129 +    } -result en_us
   1.130 +
   1.131 +    test msgcat-1.7 {mclocale get, two elements} -setup {
   1.132 +	variable locale [mclocale]
   1.133 +	mclocale en_US
   1.134 +    } -cleanup {
   1.135 +	mclocale $locale
   1.136 +    } -body {
   1.137 +	mclocale
   1.138 +    } -result en_us
   1.139 +
   1.140 +    test msgcat-1.8 {mcpreferences, two elements} -setup {
   1.141 +	variable locale [mclocale]
   1.142 +	mclocale en_US
   1.143 +    } -cleanup {
   1.144 +	mclocale $locale
   1.145 +    } -body {
   1.146 +	mcpreferences
   1.147 +    } -result {en_us en}
   1.148 +
   1.149 +    test msgcat-1.9 {mclocale set, three elements} -setup {
   1.150 +	variable locale [mclocale]
   1.151 +    } -cleanup {
   1.152 +	mclocale $locale
   1.153 +    } -body {
   1.154 +	mclocale en_US_funky
   1.155 +    } -result en_us_funky
   1.156 +
   1.157 +    test msgcat-1.10 {mclocale get, three elements} -setup {
   1.158 +	variable locale [mclocale]
   1.159 +	mclocale en_US_funky
   1.160 +    } -cleanup {
   1.161 +	mclocale $locale
   1.162 +    } -body {
   1.163 +	mclocale
   1.164 +    } -result en_us_funky
   1.165 +
   1.166 +    test msgcat-1.11 {mcpreferences, three elements} -setup {
   1.167 +	variable locale [mclocale]
   1.168 +	mclocale en_US_funky
   1.169 +    } -cleanup {
   1.170 +	mclocale $locale
   1.171 +    } -body {
   1.172 +	mcpreferences
   1.173 +    } -result {en_us_funky en_us en}
   1.174 +
   1.175 +    test msgcat-1.12 {mclocale set, reject evil input} -setup {
   1.176 +	variable locale [mclocale]
   1.177 +    } -cleanup {
   1.178 +	mclocale $locale
   1.179 +    } -body {
   1.180 +	mclocale /path/to/evil/code
   1.181 +    } -returnCodes error -match glob -result {invalid newLocale value *}
   1.182 +
   1.183 +    test msgcat-1.13 {mclocale set, reject evil input} -setup {
   1.184 +	variable locale [mclocale]
   1.185 +    } -cleanup {
   1.186 +	mclocale $locale
   1.187 +    } -body {
   1.188 +	mclocale looks/ok/../../../../but/is/path/to/evil/code
   1.189 +    } -returnCodes error -match glob -result {invalid newLocale value *}
   1.190 +
   1.191 +    # Tests msgcat-2.*: [mcset], [mcmset], namespace partitioning
   1.192 +
   1.193 +    test msgcat-2.1 {mcset, global scope} {
   1.194 +	namespace eval :: ::msgcat::mcset  foo_BAR text1 text2
   1.195 +    } {text2}
   1.196 +
   1.197 +    test msgcat-2.2 {mcset, global scope, default} {
   1.198 +	namespace eval :: ::msgcat::mcset foo_BAR text3
   1.199 +    } {text3}
   1.200 +
   1.201 +    test msgcat-2.2.1 {mcset, namespace overlap} {
   1.202 +	namespace eval baz {::msgcat::mcset  foo_BAR con1 con1baz}
   1.203 +    } {con1baz}
   1.204 +
   1.205 +    test msgcat-2.3 {mcset, namespace overlap} -setup {
   1.206 +	namespace eval bar {::msgcat::mcset  foo_BAR con1 con1bar}
   1.207 +	namespace eval baz {::msgcat::mcset  foo_BAR con1 con1baz}
   1.208 +	variable locale [mclocale]
   1.209 +	mclocale foo_BAR
   1.210 +    } -cleanup {
   1.211 +	mclocale $locale
   1.212 +    } -body {
   1.213 +	namespace eval bar {::msgcat::mc con1}
   1.214 +    } -result con1bar
   1.215 +
   1.216 +    test msgcat-2.4 {mcset, namespace overlap} -setup {
   1.217 +	namespace eval bar {::msgcat::mcset  foo_BAR con1 con1bar}
   1.218 +	namespace eval baz {::msgcat::mcset  foo_BAR con1 con1baz}
   1.219 +	variable locale [mclocale]
   1.220 +	mclocale foo_BAR
   1.221 +    } -cleanup {
   1.222 +	mclocale $locale
   1.223 +    } -body {
   1.224 +	namespace eval baz {::msgcat::mc con1}
   1.225 +    } -result con1baz
   1.226 +
   1.227 +    test msgcat-2.5 {mcmset, global scope} -setup {
   1.228 +	namespace eval :: {
   1.229 +	    ::msgcat::mcmset  foo_BAR {
   1.230 +	        src1 trans1
   1.231 +	        src2 trans2
   1.232 +	    }
   1.233 +	}
   1.234 +	variable locale [mclocale]
   1.235 +	mclocale foo_BAR
   1.236 +    } -cleanup {
   1.237 +	mclocale $locale
   1.238 +    } -body {
   1.239 +	namespace eval :: {
   1.240 +	    ::msgcat::mc src1
   1.241 +	}
   1.242 +    } -result trans1
   1.243 +
   1.244 +    test msgcat-2.6 {mcmset, namespace overlap} -setup {
   1.245 +	namespace eval bar {::msgcat::mcmset  foo_BAR {con2 con2bar}}
   1.246 +	namespace eval baz {::msgcat::mcmset  foo_BAR {con2 con2baz}}
   1.247 +	variable locale [mclocale]
   1.248 +	mclocale foo_BAR
   1.249 +    } -cleanup {
   1.250 +	mclocale $locale
   1.251 +    } -body {
   1.252 +	namespace eval bar {::msgcat::mc con2}
   1.253 +    } -result con2bar
   1.254 +
   1.255 +    test msgcat-2.7 {mcmset, namespace overlap} -setup {
   1.256 +	namespace eval bar {::msgcat::mcmset  foo_BAR {con2 con2bar}}
   1.257 +	namespace eval baz {::msgcat::mcmset  foo_BAR {con2 con2baz}}
   1.258 +	variable locale [mclocale]
   1.259 +	mclocale foo_BAR
   1.260 +    } -cleanup {
   1.261 +	mclocale $locale
   1.262 +    } -body {
   1.263 +	namespace eval baz {::msgcat::mc con2}
   1.264 +    } -result con2baz
   1.265 +
   1.266 +    # Tests msgcat-3.*: [mcset], [mc], catalog "inheritance"
   1.267 +    #
   1.268 +    # Test mcset and mc, ensuring that more specific locales
   1.269 +    # (e.g. en_UK) will search less specific locales
   1.270 +    # (e.g. en) for translation strings.
   1.271 +    #
   1.272 +    # Do this for the 12 permutations of
   1.273 +    #     locales: {foo foo_BAR foo_BAR_baz}
   1.274 +    #     strings: {ov1 ov2 ov3 ov4}
   1.275 +    #     locale foo         defines ov1, ov2, ov3
   1.276 +    #     locale foo_BAR     defines      ov2, ov3
   1.277 +    #     locale foo_BAR_BAZ defines           ov3
   1.278 +    #     (ov4 is defined in none)
   1.279 +    # So,
   1.280 +    #     ov3 should be resolved in foo, foo_BAR, foo_BAR_baz
   1.281 +    #     ov2 should be resolved in foo, foo_BAR
   1.282 +    #     ov2 should resolve to foo_BAR in foo_BAR_baz
   1.283 +    #     ov1 should be resolved in foo
   1.284 +    #     ov1 should resolve to foo in foo_BAR, foo_BAR_baz
   1.285 +    #     ov4 should be resolved in none, and call mcunknown
   1.286 +    #
   1.287 +    variable count 2
   1.288 +    variable result
   1.289 +    array set result {
   1.290 +	foo,ov1 ov1_foo foo,ov2 ov2_foo foo,ov3 ov3_foo foo,ov4 ov4
   1.291 +	foo_BAR,ov1 ov1_foo foo_BAR,ov2 ov2_foo_BAR foo_BAR,ov3 ov3_foo_BAR
   1.292 +	foo_BAR,ov4 ov4 foo_BAR_baz,ov1 ov1_foo foo_BAR_baz,ov2 ov2_foo_BAR
   1.293 +	foo_BAR_baz,ov3 ov3_foo_BAR_baz foo_BAR_baz,ov4 ov4
   1.294 +    }
   1.295 +    variable loc
   1.296 +    variable string
   1.297 +    foreach loc {foo foo_BAR foo_BAR_baz} {
   1.298 +	foreach string {ov1 ov2 ov3 ov4} {
   1.299 +	    test msgcat-3.$count {mcset, overlap} -setup {
   1.300 +		mcset foo ov1 ov1_foo
   1.301 +		mcset foo ov2 ov2_foo
   1.302 +		mcset foo ov3 ov3_foo
   1.303 +		mcset foo_BAR ov2 ov2_foo_BAR
   1.304 +		mcset foo_BAR ov3 ov3_foo_BAR
   1.305 +		mcset foo_BAR_baz ov3 ov3_foo_BAR_baz
   1.306 +		variable locale [mclocale]
   1.307 +		mclocale $loc
   1.308 +	    } -cleanup {
   1.309 +		mclocale $locale
   1.310 +	    } -body {
   1.311 +		mc $string
   1.312 +	    } -result $result($loc,$string)
   1.313 +	    incr count
   1.314 +	}
   1.315 +    }
   1.316 +    catch {unset result}
   1.317 +
   1.318 +    # Tests msgcat-4.*: [mcunknown]
   1.319 +
   1.320 +    test msgcat-4.2 {mcunknown, default} -setup {
   1.321 +	mcset foo unk1 "unknown 1"
   1.322 +	variable locale [mclocale]
   1.323 +	mclocale foo
   1.324 +    } -cleanup {
   1.325 +	mclocale $locale
   1.326 +    } -body {
   1.327 +	mc unk1
   1.328 +    } -result {unknown 1}
   1.329 +
   1.330 +    test msgcat-4.3 {mcunknown, default} -setup {
   1.331 +	mcset foo unk1 "unknown 1"
   1.332 +	variable locale [mclocale]
   1.333 +	mclocale foo
   1.334 +    } -cleanup {
   1.335 +	mclocale $locale
   1.336 +    } -body {
   1.337 +	mc unk2
   1.338 +    } -result unk2
   1.339 +
   1.340 +    test msgcat-4.4 {mcunknown, overridden} -setup {
   1.341 +	rename ::msgcat::mcunknown SavedMcunknown
   1.342 +	proc ::msgcat::mcunknown {dom s} {
   1.343 +            return unknown:$dom:$s
   1.344 +	}
   1.345 +	mcset foo unk1 "unknown 1"
   1.346 +	variable locale [mclocale]
   1.347 +	mclocale foo
   1.348 +    } -cleanup {
   1.349 +	mclocale $locale
   1.350 +	rename ::msgcat::mcunknown {}
   1.351 +	rename SavedMcunknown ::msgcat::mcunknown
   1.352 +    } -body {
   1.353 +	mc unk1
   1.354 +    } -result {unknown 1}
   1.355 +
   1.356 +    test msgcat-4.5 {mcunknown, overridden} -setup {
   1.357 +	rename ::msgcat::mcunknown SavedMcunknown
   1.358 +	proc ::msgcat::mcunknown {dom s} {
   1.359 +            return unknown:$dom:$s
   1.360 +	}
   1.361 +	mcset foo unk1 "unknown 1"
   1.362 +	variable locale [mclocale]
   1.363 +	mclocale foo
   1.364 +    } -cleanup {
   1.365 +	mclocale $locale
   1.366 +	rename ::msgcat::mcunknown {}
   1.367 +	rename SavedMcunknown ::msgcat::mcunknown
   1.368 +    } -body {
   1.369 +	mc unk2
   1.370 +    } -result {unknown:foo:unk2}
   1.371 +
   1.372 +    test msgcat-4.6 {mcunknown, uplevel context} -setup {
   1.373 +	rename ::msgcat::mcunknown SavedMcunknown
   1.374 +	proc ::msgcat::mcunknown {dom s} {
   1.375 +            return "unknown:$dom:$s:[expr {[info level] - 1}]"
   1.376 +	}
   1.377 +	mcset foo unk1 "unknown 1"
   1.378 +	variable locale [mclocale]
   1.379 +	mclocale foo
   1.380 +    } -cleanup {
   1.381 +	mclocale $locale
   1.382 +	rename ::msgcat::mcunknown {}
   1.383 +	rename SavedMcunknown ::msgcat::mcunknown
   1.384 +    } -body {
   1.385 +	mc unk2
   1.386 +    } -result unknown:foo:unk2:[info level]
   1.387 +
   1.388 +    # Tests msgcat-5.*: [mcload]
   1.389 +
   1.390 +    variable locales {foo foo_BAR foo_BAR_baz}
   1.391 +    makeDirectory msgdir
   1.392 +    foreach loc $locales {
   1.393 +	makeFile "::msgcat::mcset $loc abc abc-$loc" \
   1.394 +		[string tolower [file join msgdir $loc.msg]]
   1.395 +    }
   1.396 +    variable count 1
   1.397 +    foreach loc {foo foo_BAR foo_BAR_baz} {
   1.398 +	test msgcat-5.$count {mcload} -setup {
   1.399 +	    variable locale [mclocale]
   1.400 +	    mclocale $loc
   1.401 +	} -cleanup {
   1.402 +	    mclocale $locale
   1.403 +	} -body {
   1.404 +	    mcload [file join [temporaryDirectory] msgdir]
   1.405 +	} -result $count
   1.406 +	incr count
   1.407 +    }
   1.408 +
   1.409 +    # Even though foo_BAR_notexist does not exist,
   1.410 +    # foo_BAR and foo should be loaded.
   1.411 +	test msgcat-5.4 {mcload} -setup {
   1.412 +	    variable locale [mclocale]
   1.413 +	    mclocale foo_BAR_notexist
   1.414 +	} -cleanup {
   1.415 +	    mclocale $locale
   1.416 +	} -body {
   1.417 +	    mcload [file join [temporaryDirectory] msgdir]
   1.418 +	} -result 2
   1.419 +
   1.420 +	test msgcat-5.5 {mcload} -setup {
   1.421 +	    variable locale [mclocale]
   1.422 +	    mclocale no_FI_notexist
   1.423 +	} -cleanup {
   1.424 +	    mclocale $locale
   1.425 +	} -body {
   1.426 +	    mcload [file join [temporaryDirectory] msgdir]
   1.427 +	} -result 0
   1.428 +
   1.429 +	test msgcat-5.6 {mcload} -setup {
   1.430 +	    variable locale [mclocale]
   1.431 +	    mclocale foo
   1.432 +	} -cleanup {
   1.433 +	    mclocale $locale
   1.434 +	} -body {
   1.435 +	    mc abc
   1.436 +	} -result abc-foo
   1.437 +
   1.438 +	test msgcat-5.7 {mcload} -setup {
   1.439 +	    variable locale [mclocale]
   1.440 +	    mclocale foo_BAR
   1.441 +	} -cleanup {
   1.442 +	    mclocale $locale
   1.443 +	} -body {
   1.444 +	    mc abc
   1.445 +	} -result abc-foo_BAR
   1.446 +
   1.447 +	test msgcat-5.8 {mcload} -setup {
   1.448 +	    variable locale [mclocale]
   1.449 +	    mclocale foo_BAR_baz
   1.450 +	} -cleanup {
   1.451 +	    mclocale $locale
   1.452 +	} -body {
   1.453 +	    mc abc
   1.454 +	} -result abc-foo_BAR_baz
   1.455 +
   1.456 +	test msgcat-5.9 {mcload} -setup {
   1.457 +	    rename ::msgcat::mcunknown SavedMcunknown
   1.458 +	    proc ::msgcat::mcunknown {dom s} {
   1.459 +		return unknown:$dom:$s
   1.460 +	    }
   1.461 +	    variable locale [mclocale]
   1.462 +	    mclocale no_FI_notexist
   1.463 +	} -cleanup {
   1.464 +	    mclocale $locale
   1.465 +	    rename ::msgcat::mcunknown {}
   1.466 +	    rename SavedMcunknown ::msgcat::mcunknown
   1.467 +	} -body {
   1.468 +	    mc abc
   1.469 +	} -result unknown:no_fi_notexist:abc
   1.470 +
   1.471 +
   1.472 +    foreach loc $locales {
   1.473 +	removeFile [string tolower [file join msgdir $loc.msg]]
   1.474 +    }
   1.475 +    removeDirectory msgdir
   1.476 +
   1.477 +    # Tests msgcat-6.*: [mcset], [mc] namespace inheritance
   1.478 +#
   1.479 +# Test mcset and mc, ensuring that resolution for messages
   1.480 +# proceeds from the current ns to its parent and so on to the 
   1.481 +# global ns.
   1.482 +#
   1.483 +# Do this for the 12 permutations of
   1.484 +#     locales: foo
   1.485 +#     namespaces: foo foo::bar foo::bar::baz
   1.486 +#     strings: {ov1 ov2 ov3 ov4}
   1.487 +#     namespace ::foo            defines ov1, ov2, ov3
   1.488 +#     namespace ::foo::bar       defines      ov2, ov3
   1.489 +#     namespace ::foo::bar::baz  defines           ov3
   1.490 +#
   1.491 +#     ov4 is not defined in any namespace.
   1.492 +#
   1.493 +# So,
   1.494 +#     ov3 should be resolved in ::foo::bar::baz, ::foo::bar, ::foo;
   1.495 +#     ov2 should be resolved in ::foo, ::foo::bar
   1.496 +#     ov1 should be resolved in ::foo
   1.497 +#     ov4 should be resolved in none, and call mcunknown
   1.498 +#
   1.499 +
   1.500 +    variable result
   1.501 +    array set result {
   1.502 +	foo,ov1 ov1_foo foo,ov2 ov2_foo foo,ov3 ov3_foo foo,ov4 ov4
   1.503 +	foo::bar,ov1 ov1_foo foo::bar,ov2 ov2_foo_bar
   1.504 +	foo::bar,ov3 ov3_foo_bar foo::bar,ov4 ov4 foo::bar::baz,ov1 ov1_foo
   1.505 +	foo::bar::baz,ov2 ov2_foo_bar foo::bar::baz,ov3 ov3_foo_bar_baz
   1.506 +	foo::bar::baz,ov4 ov4
   1.507 +    }
   1.508 +    variable count 1
   1.509 +    variable ns
   1.510 +    foreach ns {foo foo::bar foo::bar::baz} {
   1.511 +	foreach string {ov1 ov2 ov3 ov4} {
   1.512 +	    test msgcat-6.$count {mcset, overlap} -setup {
   1.513 +		namespace eval foo {
   1.514 +		    ::msgcat::mcset foo ov1 ov1_foo
   1.515 +		    ::msgcat::mcset foo ov2 ov2_foo
   1.516 +		    ::msgcat::mcset foo ov3 ov3_foo
   1.517 +		    namespace eval bar {
   1.518 +			::msgcat::mcset foo ov2 ov2_foo_bar
   1.519 +			::msgcat::mcset foo ov3 ov3_foo_bar
   1.520 +			namespace eval baz {
   1.521 +			    ::msgcat::mcset foo ov3 "ov3_foo_bar_baz"
   1.522 +			}
   1.523 +		    }
   1.524 +		    
   1.525 +		}
   1.526 +		variable locale [mclocale]
   1.527 +		mclocale foo
   1.528 +	    } -cleanup {
   1.529 +		mclocale $locale
   1.530 +		namespace delete foo
   1.531 +	    } -body {
   1.532 +		namespace eval $ns [list ::msgcat::mc $string]
   1.533 +	    } -result $result($ns,$string)
   1.534 +	    incr count
   1.535 +	}
   1.536 +    }
   1.537 +
   1.538 +    # Tests msgcat-7.*: [mc] extra args processed by [format]
   1.539 +
   1.540 +    test msgcat-7.1 {mc extra args go through to format} -setup {
   1.541 +	mcset foo format1 "this is a test"
   1.542 +	mcset foo format2 "this is a %s"
   1.543 +	mcset foo format3 "this is a %s %s"
   1.544 +	variable locale [mclocale]
   1.545 +	mclocale foo
   1.546 +    } -cleanup {
   1.547 +	mclocale $locale
   1.548 +    } -body {
   1.549 +	mc format1 "good test"
   1.550 +    } -result "this is a test"
   1.551 +
   1.552 +    test msgcat-7.2 {mc extra args go through to format} -setup {
   1.553 +	mcset foo format1 "this is a test"
   1.554 +	mcset foo format2 "this is a %s"
   1.555 +	mcset foo format3 "this is a %s %s"
   1.556 +	variable locale [mclocale]
   1.557 +	mclocale foo
   1.558 +    } -cleanup {
   1.559 +	mclocale $locale
   1.560 +    } -body {
   1.561 +	mc format2 "good test"
   1.562 +    } -result "this is a good test"
   1.563 +
   1.564 +    test msgcat-7.3 {mc errors from format are propagated} -setup {
   1.565 +	mcset foo format1 "this is a test"
   1.566 +	mcset foo format2 "this is a %s"
   1.567 +	mcset foo format3 "this is a %s %s"
   1.568 +	variable locale [mclocale]
   1.569 +	mclocale foo
   1.570 +    } -cleanup {
   1.571 +	mclocale $locale
   1.572 +    } -body {
   1.573 +	catch {mc format3 "good test"}
   1.574 +    } -result 1
   1.575 +
   1.576 +    test msgcat-7.4 {mc, extra args are given to unknown} -setup {
   1.577 +	mcset foo format1 "this is a test"
   1.578 +	mcset foo format2 "this is a %s"
   1.579 +	mcset foo format3 "this is a %s %s"
   1.580 +	variable locale [mclocale]
   1.581 +	mclocale foo
   1.582 +    } -cleanup {
   1.583 +	mclocale $locale
   1.584 +    } -body {
   1.585 +	mc "this is a %s" "good test"
   1.586 +    } -result "this is a good test"
   1.587 +
   1.588 +    cleanupTests
   1.589 +}
   1.590 +namespace delete ::msgcat::test
   1.591 +return
   1.592 +