home *** CD-ROM | disk | FTP | other *** search
- #
- # msgcat.test
- #
- # Tests for the XPG/3 message catalog commands.
- #---------------------------------------------------------------------------
- # Copyright 1992-1993 Karl Lehenbauer and Mark Diekhans.
- #
- # Permission to use, copy, modify, and distribute this software and its
- # documentation for any purpose and without fee is hereby granted, provided
- # that the above copyright notice appear in all copies. Karl Lehenbauer and
- # Mark Diekhans make no representations about the suitability of this
- # software for any purpose. It is provided "as is" without express or
- # implied warranty.
- #------------------------------------------------------------------------------
- # $Id: msgcat.test,v 3.0 1993/11/19 06:57:56 markd Rel $
- #------------------------------------------------------------------------------
-
- if {[info procs test] != "test"} then {source testlib.tcl}
-
- #
- # This only tests default strings, since its difficult to setup and rely on
- # a message catalog being present. This will work on systems without message
- # catalogs, as the stubs return default strings.
- #
-
- Test message-cat-1.1 {catopen tests} {
- set msgcat [catopen "FOOBAZWAP"]
- catclose $msgcat
- crange $msgcat 0 5
- } 0 {msgcat}
-
-
- Test message-cat-1.2 {catopen tests} {
- set msgcat [catopen -nofail "FOOBAZWAP"]
- catclose $msgcat
- crange $msgcat 0 5
- } 0 {msgcat}
-
-
- Test message-cat-1.3 {catopen tests} {
- list [catch {catopen -fail "FOOBAZWAP"} msg] $msg
- case $msg {
- {"open of message catalog failed"} {concat "OK"}
- {"the message catalog facility is not available, default string is always returned"} {concat "OK"}
- default {concat "Bad catopen return: $msg"}
- }
- } 0 {OK}
-
- Test message-cat-2.1 {catclose tests} {
- set msgcat [catopen "FOOBAZWAP"]
- catclose $msgcat
- catgets $msgcat
- } 1 {wrong # args: catgets catHandle setnum msgnum defaultstr}
-
-
- Test message-cat-2.2 {catclose tests} {
- set msgcat [catopen "FOOBAZWAP"]
- catclose $msgcat
- } 0 {}
-
- Test message-cat-2.3 {catclose tests} {
- set msgcat [catopen "FOOBAZWAP"]
- catclose -nofail $msgcat
- } 0 {}
-
- Test message-cat-2.4 {catclose tests} {
- set msgcat [catopen "FOOBAZWAP"]
- catclose $msgcat
- catclose -fail $msgcat
- } 1 {msgcat is not open}
-
-
- Test message-cat-2.5 {catclose tests} {
- catclose baz
- } 1 {invalid msgcat handle: baz}
-
- Test message-cat-2.6 {catclose tests} {
- catclose
- } 1 {wrong # args: catclose ?-fail|-nofail? catHandle}
-
-
- Test message-cat-3.1 {catgets tests} {
- set msgcat [catopen "FOOBAZWAP"]
- catgets $msgcat 1 12 "This is a test"
- } 0 {This is a test}
- catch {catclose $msgcat}
-
- Test message-cat-3.2 {catgets tests} {
- set msgcat [catopen "FOOBAZWAP"]
- catgets $msgcat 101 12 "This is an actual emergency"
- } 0 {This is an actual emergency}
- catch {catclose $msgcat}
-
- Test message-cat-3.3 {catgets tests} {
- set msgcat [catopen "FOOBAZWAP"]
- catclose $msgcat
- catgets $msgcat 101 12 "This is an actual emergency"
- } 1 {msgcat is not open}
-
- Test message-cat-3.4 {catgets tests} {
- set msgcat [catopen "FOOBAZWAP"]
- catgets $msgcat xx 12 "This is an actual emergency"
- } 1 {expected integer but got "xx"}
- catch {catclose $msgcat}
-
- Test message-cat-3.5 {catgets tests} {
- set msgcat [catopen "FOOBAZWAP"]
- catgets $msgcat 102 "This is an actual emergency"
- } 1 {wrong # args: catgets catHandle setnum msgnum defaultstr}
- catch {catclose $msgcat}
-
-